Archive for January, 2024

Laravel laravel-entrust specify multiple roles in web guard.

Friday, January 5th, 2024

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');
})
;