简体   繁体   中英

How to use AuthServiceProvider from routes.php in Laravel?

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 .

http://heera.it/laravel-5-1-x-acl-middleware#.Vt1VvnV957g

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM