<?php

use App\Admin\Controllers\DistAppearanceTemplateController;
use Illuminate\Routing\Router;
use Illuminate\Support\Facades\Route;
use Dcat\Admin\Admin;

Admin::routes();

Route::group([
    'prefix'     => config('admin.route.prefix'),
    'namespace'  => config('admin.route.namespace'),
    'middleware' => config('admin.route.middleware'),
], function (Router $router) {
    //主页
    $router->get('/', 'HomeController@index');

    // 定义切换语言的路由
    $router->get('language-switch','LanguageController@index');
    // 不需要登录的路由
    $router->get('captcha','CaptchaController@generate');
    //文件夹
    $router->resource('site-folder', 'SiteAlbumFolderController');
    //相册
    $router->resource('site-album', 'SiteAlbumController');
});

/*
 * 重写上传路由，修改tinymce上传路径
 */
$attributes = [
    'prefix'     => admin_base_path('dcat-api'),
    'middleware' => config('admin.route.middleware'),
    'as'         => 'dcat-api.',
];
app('router')->group($attributes, function ($router) {
    $router->post('editor-md/upload', function () {exit;})->name('editor-md.upload');
    $router->post('tinymce/upload', 'App\Http\Controllers\TinymceController@upload')->name('tinymce.upload');
});
