Route::get('/teacher', [
'uses' => 'AppController@getTeacherPage',
'as' => 'teacher',
'middleware' => 'roles',
'roles' => ['Admin', 'Teacher']
]);
如何将其转换为资源
我试过像
这样的东西Route::resource('teacher',TeacherController, [
'uses' => 'TeacherController@index',
'as' => 'teacher',
'middleware' => 'roles',
'roles' => ['Admin', 'Teacher']
]);
答案 0 :(得分:0)
Route::resource('teachers',TeacherController, [
'names' => [
'teachers' => 'teachers.index',
'teacher' => 'teachers.show'
],
'middleware' => 'roles',
'roles' => ['Admin', 'Teacher']
]);
将匹配index()
和show($id)
个功能。