mardi 22 décembre 2015

How can I assgin multiple role to any laravel route?

I created one middleware to check user roles("superadmin","admin" and "user").

And its working fine for one say for 'admin', if I use single role role.

Route::get('users',['middleware' => 'role:superadmin', function () {
    return view('users_list');
}]);

But the problem is to give access to multiple role here. I tried this but not working.

Route::get('users',['middleware' => 'role:superadmin,admin', function () {
    return view('users_list');
}]);

Although here I am getting role 'superadmin' not admin. But I think its wrong.

Please suggest me to give multiple role for any route.

Also I have gone through http://ift.tt/1dURk13 but found many open issues http://ift.tt/1QIaYX0. Please suggest me if you have any better idea than start with 'Zizaco'.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire