vendredi 25 janvier 2019

How add extra middleware in grup route?

I create admin panel and want give access to some role like admin, mod, support, god etc. But in the same group one of route i would like give access only for God and Admin. Can i do this in one group or should i create separate group for this route (separate group or add middleware to one route only) but i prefer separate group.

Route::group(['prefix' => 'admin', 'middleware' => ['roles'], 'roles' => ['administrator', 'moderator', 'support']], function () {
        Route::get('/', 'AdminController@index')->name('admin.index');
        Route::get('users', 'AdminController@users')->name('admin.users');
        Route::get('messages', 'AdminController@messages')->name('admin.messages');    
    });

And separate group

Route::group(['prefix' => 'admin', 'middleware' => ['roles'], 'roles' => ['administrator']], function () {
        Route::get('finance', 'AdminController@finance')->name('admin.finance');
    });

How can i do in one group. I tried but i have access all the to the finance method even if i am support only.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire