eTechtips

Tech Tips and Insights

Laravel laravel-entrust specify multiple roles in web guard.

/ ,

I was writing a Meeting tracking app in Laravel and using the shanmuga3/laravel-entrust module for roles and permissions. I created a new role for the application but needed to support some superadmin functionality within the site but was having issues with some of the routing. I found that padding the superadmin and admin with a pipe delimited list directly to the ‘role:’ entry worked.

Route::group(['prefix' => 'admin','middleware' => ['role:superadmin|admin']], function() {

        Route::get('/settings', function() {
          return "a";
        })->name('admin.edit');
})
;

Loading

0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.