#Laravel 5 Simple ACL manager
Protect your routes with user roles. Simply add a 'role_id' to the User model, install the roles table and seed if you need some example roles to get going.
If the user has a 'Root' role, then they can perform any actions.
Simply copy the files across into the appropriate directories, and register the middleware in App\Http\Kernel.php
Then specify a 'roles' middleware on the route you'd like to protect, and specify the individual roles as an array:
Route::get('user/{user}', [
'middleware' => ['auth', 'roles'],
'uses' => 'UserController@index',
'roles' => ['administrator', 'manager']
]);
If you found this ACL manager helpful please give this repo a star, and give me a follow. Any questions, please leave a comment.
Hi, im using the make:auth and I'm new to laravel. I have added a column "type" in the users table to determine if the user is an admin or super admin or just a user. I was able to protect the components of my view files (like buttons, tables) using the "type" column but the problem is the routes of the super admin can still access by the admin... My question is, how can I use your solution on my current situation? Or do you have any idea how to protect the routes base on the column "type"?