I tried using entrust package and works well. I have different types of roles assign to different users. The users are have roles access to dashboard to do according to their permission. I need to make middleware on routes using entrust package to check user has last one role and permission before access the dashboard. or if there other best performance/solution to do this.
Asked
Active
Viewed 37 times
1 Answers
0
Entrust has its own middleware,
'role' => \Zizaco\Entrust\Middleware\EntrustRole::class,
'permission' => \Zizaco\Entrust\Middleware\EntrustPermission::class,
'ability' => \Zizaco\Entrust\Middleware\EntrustAbility::class,
You just need to register them in App\Http\Kernel.php
.
In your routes\web.php
create a group with a middleware for specific users:
Route::group(['middleware'=> 'role'], function({
Route::get('/somelink', 'SomeController@somefunction');
});

AntonyMN
- 660
- 6
- 18
-
The issuse is I need to provide 1 parameter exactly as in the docs: ->middleware('role:editor') – Amr Abdalrahman Ahmed Sep 25 '18 at 09:35