fix: use unique routes name

This commit is contained in:
Asnxthaony 2023-05-27 00:36:00 +08:00
parent 1e8c0f85d5
commit a13879f2df
No known key found for this signature in database
GPG Key ID: 6537C59306464F54
2 changed files with 66 additions and 65 deletions

View File

@ -32,15 +32,15 @@ class UserMenuComposer
$menuItems = [ $menuItems = [
['label' => trans('general.user-center'), 'link' => route('user.home')], ['label' => trans('general.user-center'), 'link' => route('user.home')],
['label' => trans('general.profile'), 'link' => route('user.profile.')], ['label' => trans('general.profile'), 'link' => route('user.profile.view')],
]; ];
if ($user->isAdmin()) { if ($user->isAdmin()) {
array_push( array_push(
$menuItems, $menuItems,
['label' => '', 'link' => '#divider'], ['label' => '', 'link' => '#divider'],
['label' => trans('general.admin-panel'), 'link' => route('admin.')], ['label' => trans('general.admin-panel'), 'link' => route('admin.view')],
['label' => trans('general.user-manage'), 'link' => route('admin.users.')], ['label' => trans('general.user-manage'), 'link' => route('admin.users.view')],
['label' => trans('general.report-manage'), 'link' => route('admin.reports.')], ['label' => trans('general.report-manage'), 'link' => route('admin.reports.view')],
['label' => 'Web CLI', 'link' => '#launch-cli'], ['label' => 'Web CLI', 'link' => '#launch-cli'],
); );
} }

View File

@ -13,34 +13,35 @@ use App\Http\Middleware;
| |
*/ */
Route::get('', 'HomeController@index'); Route::get('', 'HomeController@index')->name('home');
Route::prefix('auth')->name('auth.')->group(function () { Route::prefix('auth')->name('auth.')->group(function () {
Route::middleware('guest')->group(function () { Route::middleware('guest')->group(function () {
Route::get('login', 'AuthController@login')->name('login'); Route::get('login', 'AuthController@login')->name('login');
Route::post('login', 'AuthController@handleLogin'); Route::post('login', 'AuthController@handleLogin')->name('handle.login');
Route::get('register', 'AuthController@register')->name('register'); Route::get('register', 'AuthController@register')->name('register');
Route::post('register', 'AuthController@handleRegister'); Route::post('register', 'AuthController@handleRegister')->name('handle.register');
Route::get('forgot', 'AuthController@forgot')->name('forgot'); Route::get('forgot', 'AuthController@forgot')->name('forgot');
Route::post('forgot', 'AuthController@handleForgot'); Route::post('forgot', 'AuthController@handleForgot')->name('handle.forgot');
Route::get('reset/{uid}', 'AuthController@reset')->name('reset'); Route::get('reset/{uid}', 'AuthController@reset')->name('reset');
Route::post('reset/{uid}', 'AuthController@handleReset'); Route::post('reset/{uid}', 'AuthController@handleReset')->name('handle.reset');
}); });
Route::post('logout', 'AuthController@logout')->name('logout')->middleware('authorize'); Route::post('logout', 'AuthController@logout')->name('logout')->middleware('authorize');
Route::any('captcha', 'AuthController@captcha'); Route::any('captcha', 'AuthController@captcha')->name('captcha');
Route::middleware(['authorize', Middleware\EnsureEmailFilled::class]) Route::middleware(['authorize', Middleware\EnsureEmailFilled::class])
->name('bind.')
->group(function () { ->group(function () {
Route::view('bind', 'auth.bind'); Route::view('bind', 'auth.bind')->name('view');
Route::post('bind', 'AuthController@fillEmail'); Route::post('bind', 'AuthController@fillEmail')->name('verify');
}); });
Route::get('verify/{user}', 'AuthController@verify')->name('verify'); Route::get('verify/{user}', 'AuthController@verify')->name('verify');
Route::post('verify/{user}', 'AuthController@handleVerify'); Route::post('verify/{user}', 'AuthController@handleVerify')->name('handle.verify');
}); });
Route::prefix('user') Route::prefix('user')
@ -48,27 +49,27 @@ Route::prefix('user')
->middleware(['authorize']) ->middleware(['authorize'])
->group(function () { ->group(function () {
Route::get('', 'UserController@index')->name('home'); Route::get('', 'UserController@index')->name('home');
Route::post('notifications/{id}', 'NotificationsController@read')->name('notification'); Route::post('notifications/{id}', 'NotificationsController@read')->name('notification.read');
Route::get('score-info', 'UserController@scoreInfo')->name('score'); Route::get('score-info', 'UserController@scoreInfo')->name('score');
Route::post('sign', 'UserController@sign')->name('sign'); Route::post('sign', 'UserController@sign')->name('sign');
Route::get('reports', 'ReportController@track'); Route::get('reports', 'ReportController@track')->name('list');
Route::prefix('profile')->name('profile.')->group(function () { Route::prefix('profile')->name('profile.')->group(function () {
Route::get('', 'UserController@profile'); Route::get('', 'UserController@profile')->name('view');
Route::post('', 'UserController@handleProfile'); Route::post('', 'UserController@handleProfile')->name('handle.profile');
Route::post('avatar', 'UserController@setAvatar')->name('avatar'); Route::post('avatar', 'UserController@setAvatar')->name('avatar');
}); });
Route::post('email-verification', 'UserController@sendVerificationEmail'); Route::post('email-verification', 'UserController@sendVerificationEmail')->name('email-verification');
Route::put('dark-mode', 'UserController@toggleDarkMode'); Route::put('dark-mode', 'UserController@toggleDarkMode')->name('dark-mode');
Route::prefix('player') Route::prefix('player')
->name('player.') ->name('player.')
->middleware('verified') ->middleware('verified')
->group(function () { ->group(function () {
Route::get('', 'PlayerController@index')->name('page'); Route::get('', 'PlayerController@index')->name('view');
Route::get('list', 'PlayerController@list')->name('list'); Route::get('list', 'PlayerController@list')->name('list');
Route::post('', 'PlayerController@add')->name('add'); Route::post('', 'PlayerController@add')->name('add');
Route::put('{player}/textures', 'PlayerController@setTexture')->name('set'); Route::put('{player}/textures', 'PlayerController@setTexture')->name('set');
@ -78,7 +79,7 @@ Route::prefix('user')
}); });
Route::prefix('closet')->name('closet.')->group(function () { Route::prefix('closet')->name('closet.')->group(function () {
Route::get('', 'ClosetController@index')->name('page'); Route::get('', 'ClosetController@index')->name('view');
Route::get('list', 'ClosetController@getClosetData')->name('list'); Route::get('list', 'ClosetController@getClosetData')->name('list');
Route::get('ids', 'ClosetController@allIds')->name('ids'); Route::get('ids', 'ClosetController@allIds')->name('ids');
Route::post('', 'ClosetController@add')->name('add'); Route::post('', 'ClosetController@add')->name('add');
@ -110,8 +111,8 @@ Route::prefix('skinlib')->name('skinlib.')->group(function () {
Route::get('list', 'SkinlibController@library')->name('list'); Route::get('list', 'SkinlibController@library')->name('list');
Route::middleware(['authorize', 'verified'])->group(function () { Route::middleware(['authorize', 'verified'])->group(function () {
Route::get('upload', 'SkinlibController@upload'); Route::get('upload', 'SkinlibController@upload')->name('upload');
Route::post('report', 'ReportController@submit'); Route::post('report', 'ReportController@submit')->name('report');
}); });
}); });
@ -119,19 +120,19 @@ Route::prefix('admin')
->name('admin.') ->name('admin.')
->middleware(['authorize', 'role:admin']) ->middleware(['authorize', 'role:admin'])
->group(function () { ->group(function () {
Route::get('', 'AdminController@index'); Route::get('', 'AdminController@index')->name('view');
Route::get('chart', 'AdminController@chartData'); Route::get('chart', 'AdminController@chartData')->name('chart');
Route::post('notifications/send', 'NotificationsController@send'); Route::post('notifications/send', 'NotificationsController@send')->name('notification.send');
Route::any('customize', 'OptionsController@customize'); Route::any('customize', 'OptionsController@customize')->name('customize');
Route::any('score', 'OptionsController@score'); Route::any('score', 'OptionsController@score')->name('score');
Route::any('options', 'OptionsController@options'); Route::any('options', 'OptionsController@options')->name('options');
Route::any('resource', 'OptionsController@resource'); Route::any('resource', 'OptionsController@resource')->name('resource');
Route::get('status', 'AdminController@status'); Route::get('status', 'AdminController@status')->name('status');
Route::prefix('users')->name('users.')->group(function () { Route::prefix('users')->name('users.')->group(function () {
Route::view('', 'admin.users'); Route::view('', 'admin.users')->name('view');
Route::get('list', 'UsersManagementController@list')->name('list'); Route::get('list', 'UsersManagementController@list')->name('list');
Route::prefix('{user}')->group(function () { Route::prefix('{user}')->group(function () {
Route::put('email', 'UsersManagementController@email')->name('email'); Route::put('email', 'UsersManagementController@email')->name('email');
@ -145,7 +146,7 @@ Route::prefix('admin')
}); });
Route::prefix('players')->name('players.')->group(function () { Route::prefix('players')->name('players.')->group(function () {
Route::view('', 'admin.players'); Route::view('', 'admin.players')->name('view');
Route::get('list', 'PlayersManagementController@list')->name('list'); Route::get('list', 'PlayersManagementController@list')->name('list');
Route::prefix('{player}')->group(function () { Route::prefix('{player}')->group(function () {
Route::put('name', 'PlayersManagementController@name')->name('name'); Route::put('name', 'PlayersManagementController@name')->name('name');
@ -155,56 +156,56 @@ Route::prefix('admin')
}); });
}); });
Route::prefix('closet')->group(function () { Route::prefix('closet')->name('closet.')->group(function () {
Route::post('{user}', 'ClosetManagementController@add'); Route::post('{user}', 'ClosetManagementController@add')->name('add');
Route::delete('{user}', 'ClosetManagementController@remove'); Route::delete('{user}', 'ClosetManagementController@remove')->name('remove');
}); });
Route::prefix('reports')->name('reports.')->group(function () { Route::prefix('reports')->name('reports.')->group(function () {
Route::view('', 'admin.reports'); Route::view('', 'admin.reports')->name('view');
Route::put('{report}', 'ReportController@review'); Route::put('{report}', 'ReportController@review')->name('review');
Route::get('list', 'ReportController@manage'); Route::get('list', 'ReportController@manage')->name('list');
}); });
Route::prefix('i18n')->group(function () { Route::prefix('i18n')->name('i18n.')->group(function () {
Route::view('', 'admin.i18n'); Route::view('', 'admin.i18n')->name('view');
Route::get('list', 'TranslationsController@list'); Route::get('list', 'TranslationsController@list')->name('list');
Route::post('', 'TranslationsController@create'); Route::post('', 'TranslationsController@create')->name('create');
Route::put('{line}', 'TranslationsController@update'); Route::put('{line}', 'TranslationsController@update')->name('update');
Route::delete('{line}', 'TranslationsController@delete'); Route::delete('{line}', 'TranslationsController@delete')->name('delete');
}); });
Route::prefix('plugins')->group(function () { Route::prefix('plugins')->name('plugins.')->group(function () {
Route::get('data', 'PluginController@getPluginData'); Route::get('data', 'PluginController@getPluginData')->name('data');
Route::view('manage', 'admin.plugins'); Route::view('manage', 'admin.plugins')->name('view');
Route::post('manage', 'PluginController@manage'); Route::post('manage', 'PluginController@manage')->name('view');
Route::any('config/{name}', 'PluginController@config'); Route::any('config/{name}', 'PluginController@config')->name('config');
Route::get('readme/{name}', 'PluginController@readme'); Route::get('readme/{name}', 'PluginController@readme')->name('readme');
Route::middleware('role:super-admin')->group(function () { Route::middleware('role:super-admin')->group(function () {
Route::post('upload', 'PluginController@upload'); Route::post('upload', 'PluginController@upload')->name('upload');
Route::post('wget', 'PluginController@wget'); Route::post('wget', 'PluginController@wget')->name('wget');
}); });
Route::prefix('market')->group(function () { Route::prefix('market')->name('market.')->group(function () {
Route::view('', 'admin.market'); Route::view('', 'admin.market')->name('view');
Route::get('list', 'MarketController@marketData'); Route::get('list', 'MarketController@marketData')->name('list');
Route::post('download', 'MarketController@download'); Route::post('download', 'MarketController@download')->name('download');
}); });
}); });
Route::prefix('update')->middleware('role:super-admin')->group(function () { Route::prefix('update')->name('update.')->middleware('role:super-admin')->group(function () {
Route::get('', 'UpdateController@showUpdatePage'); Route::get('', 'UpdateController@showUpdatePage')->name('view');
Route::post('download', 'UpdateController@download'); Route::post('download', 'UpdateController@download')->name('download');
}); });
}); });
Route::prefix('setup')->group(function () { Route::prefix('setup')->name('setup.')->group(function () {
Route::middleware('setup')->group(function () { Route::middleware('setup')->group(function () {
Route::view('', 'setup.wizard.welcome'); Route::view('', 'setup.wizard.welcome')->name('view');
Route::any('database', 'SetupController@database'); Route::any('database', 'SetupController@database')->name('database');
Route::view('info', 'setup.wizard.info'); Route::view('info', 'setup.wizard.info')->name('info');
Route::post('finish', 'SetupController@finish'); Route::post('finish', 'SetupController@finish')->name('finish');
}); });
}); });