Skip to content
Icon

WARNING You're browsing the documentation for an old version of LARAVEL-ACL. Consider upgrading your project to laravel-acl 10.0.

Route Middleware

role

Check if the user has the given role to access the route.

Route::get('users/index', function() {
// ...
})->middleware('role:administrator');

For multiple roles, use | as the delimiter.

Route::get('users/index', function() {
// ...
})->middleware('role:administrator|cashier');

permission

Check if the user has the given permission to access the route.

Route::get('users/index', function() {
// ...
})->middleware('permission:users.view');

canAtLeast

Check if the user has at least one of the given permission(s) to access the route.

{tip} Use comma separated list for multiple permissions.

Checking multiple permissions on a given route:

Route::get('users/index', function() {
// ...
})->middleware('canAtLeast:users.view,users.create');