Laravel 中间件除外
我有一组应用auth中间件的路由 除了比赛,我该怎么做 我只找到了使用$this->中间件语法的示例,但没有找到使用Route::group的示例Laravel 中间件除外,laravel,Laravel,我有一组应用auth中间件的路由 除了比赛,我该怎么做 我只找到了使用$this->中间件语法的示例,但没有找到使用Route::group的示例 Route::group(['middleware' => ['auth']], function () { Route::resource('tournaments', 'TournamentController', [ 'names' => [ 'index' => 'tournaments.index'
Route::group(['middleware' => ['auth']],
function () {
Route::resource('tournaments', 'TournamentController', [
'names' => [
'index' => 'tournaments.index',
'show' => 'tournaments.show',
'create' => 'tournaments.create',
'edit' => 'tournaments.edit', 'store' => 'tournaments.store', 'update' => 'tournaments.update' ],
]);
});
您可以通过资源()
将路由显示为:
Route::group(['middleware' => ['auth']],
function () {
Route::resource('tournaments', 'TournamentController',
[
'names' =>
['index' => 'tournaments.index',
'create' => 'tournaments.create',
'edit' => 'tournaments.edit',
'store' => 'tournaments.store',
'update' => 'tournaments.update'
],
'except' => ['show'],
]
);
});
然后在组外将其定义为:
Route::get('tournaments/{id}', 'TournamentController@show')->name('tournaments.show');
您可以通过资源()
将路由显示为:
Route::group(['middleware' => ['auth']],
function () {
Route::resource('tournaments', 'TournamentController',
[
'names' =>
['index' => 'tournaments.index',
'create' => 'tournaments.create',
'edit' => 'tournaments.edit',
'store' => 'tournaments.store',
'update' => 'tournaments.update'
],
'except' => ['show'],
]
);
});
然后在组外将其定义为:
Route::get('tournaments/{id}', 'TournamentController@show')->name('tournaments.show');