我想对资源的所有路线进行授权检查。例如:
我可以通过在资源路由上应用"can" middleware来实现此目标,例如:
Route::resource('doctors', 'DoctorsController')->middleware('can:*,App\Doctor');
谢谢!
答案 0 :(得分:0)
在DoctorsController构造函数中,您可以使用:
$this->middleware('can:<something>,App\Doctor');
Reference: https://stackoverflow.com/questions/28729228/laravel-5-route-resources-middleware
答案 1 :(得分:-1)
Route::resource('doctors', 'DoctorsController', ['middleware' => ['middleware1', 'middleware2', 'middleware3']]);