Debug Access
Use access:debug to inspect a user in a scope.
bash
php artisan access:debug david@example.com --scope=company:1The command uses default_scope_model to resolve the scope ID. Configure it first:
php
'default_scope_model' => App\Models\Company::class,If permissions look stale after changing assignments or role definitions, clear the package cache:
bash
php artisan access:clearCommon Checks
If a user cannot perform an action, check these in order:
- The user has the expected role in the expected scope.
- The role includes the expected permission.
- The policy is checking the same scope where the role was assigned.
- The enum value matches the database permission name.
- Cache was cleared after role or assignment changes.
Scope Mismatches
This assignment:
php
$user->in($companyA)->assignRole('Owner');does not allow this check:
php
$user->in($companyB)->can(Permission::UsersInvite);That isolation is intentional. If access should apply across multiple companies, assign the role in each scope or use a global role for platform-level actions.