Route::group(['controller' => [AdminController::class], 'middleware' => ['role:administrator']], function () {
Route::get('/admin', 'index');
});
它不识别AdminController
Route::controller(AdminController::class)
->middleware('role:administrator'))
->group(function () {
Route::get('/admin', 'index');
});
关于路由控制器组的更多信息,请参见https://laravel.com/docs/9.x/routing#route-group-controllers