islamrumon/laravel-acl
Laravel ACL provides database-backed roles, groups, and permissions for Laravel 5.8+. Note: unmaintained since Jan 2024; consider spatie/laravel-permission instead.
When you are using custom guards in your application, they act like namespaces for your permissions and groups. Every guard has its own permissions that can be assigned to their user model. The downside of this is that when working with multiple guards, because this package requires you to register a permission name for each guard you want to authenticate with, you would have to define the same permission multiple times for each guard that you are using.
When you create a new permission or group, the first defined guard in config/auth.php on guards config array will be used.
To check if a user has permission for a specific guard, you can pass the guard as second parameter to the hasPermission method:
$user->hasPermission('create posts', 'api');
When determining if a given group or permission is valid for a given model, it checks against the first matching guard in this order:
guardName() method if it exists on the model;$guard_name property if it exists on the model;config/auth.php in guards key that matches the logged-in user's guard;config/auth.php on defaults.guard config;How can I help you explore Laravel packages today?