我有一组我应用auth中间件的路线。
除了tournaments.show ????
我该怎么办?我只找到了带有$ this->中间件语法的示例,但没有找到带有Route :: group
的示例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' ],
]);
});
答案 0 :(得分:2)
您可以show
resource()
路由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');
然后在组外定义:
break