Seen the laravel AuthServiceProvider functionalities, https://laravel.com/docs/5.1/authorization , I'd need to filter routes based upon user permissions, like:
Route::group(['middleware' => 'can','action'="user.admin"], function () {
Route::any('/', ['as' => 'user.index', 'uses' => 'UserController@index']);
Route::any('{id}', ['as' => 'user.show', 'uses' => 'UserController@show']);
});
How to do this?
You should see this doc . Here is a good explanation of ACL in laravel 5 .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.