mschwarzmueller / laravel-playground

Laravel Playground (YouTube Tutorial Series) Repository
MIT License
57 stars 40 forks source link

Dosn't work for laravel 5.7 #5

Open atefehkianfar1 opened 5 years ago

atefehkianfar1 commented 5 years ago

Hello there, I used this code for a project in Laravel 5.3 last year now I want to use it in Laravel 5.7 but it won't work actually I think it won't support defining the routes like this : Route::get('/productRequestFollow',[ 'uses'=>'RequestController@productRequestFollowGet', 'middleware' => 'roles', 'roles'=>['supplierManager','unitManager','user','systemManager'] ]);

SuleymanAli commented 5 years ago

In Route : You can add parameter to your middleware separated by colon and also use comma for multiple parameter Route::resource('admin', 'AdminController')->middleware('roles:Admin,Author');

In Middleware : To use in middleware add parameter to handle function. If you want multiple parameter(array) use 3 dots public function handle($request, Closure $next, ...$role)