# By user ID
php artisan user:show 1
# By email
php artisan user:show john@example.com
# With specific guard
php artisan user:show 1 --guard=apiShows:
- User information (ID, name, email)
- All roles assigned to the user
- All permissions from those roles
- Grouped by module for easy reading
# By role name
php artisan role:show admin
# By role ID
php artisan role:show 1
# Include users with this role
php artisan role:show admin --with-users
# With specific guard
php artisan role:show admin --guard=webShows:
- Role information (ID, name, description, guard)
- All permissions assigned to the role
- Optionally: All users with this role
# By module name
php artisan module:show users
# By module ID
php artisan module:show 1
# Include roles with access
php artisan module:show users --with-roles
# With specific guard
php artisan module:show users --guard=webShows:
- Module information (ID, name, description, guard)
- All available actions (permissions) for the module
- Optionally: All roles that have access to this module
# List all permissions
php artisan permissions:list
# Filter by role
php artisan permissions:list --role=admin
# Filter by module
php artisan permissions:list --module=users
# Filter by guard
php artisan permissions:list --guard=api# Preview what will be synced
php artisan permissions:sync --preview
# Sync from routes
php artisan permissions:sync --source=routes
# Sync from controllers directory
php artisan permissions:sync --source=controllers
# Sync with specific guard
php artisan permissions:sync --guard=api
# Sync from custom path
php artisan permissions:sync --source=controllers --path=/path/to/controllers# Create role with description
php artisan role:create admin --description="Administrator role"
# Create role with specific guard
php artisan role:create editor --guard=api# Assign single permission (auto-creates module and action if needed)
php artisan role:assign-permission admin users create
# Assign with specific guard
php artisan role:assign-permission editor posts update --guard=web# Assign ALL permissions to a role
php artisan role:assign-all-permissions super-admin
# Assign all permissions for a specific module
php artisan role:assign-all-permissions manager --module=users
# Assign all permissions for a specific action across all modules
php artisan role:assign-all-permissions reader --action=read
# Combine filters: all 'create' permissions for 'users' module
php artisan role:assign-all-permissions editor --module=users --action=create
# Skip confirmation prompt (useful for scripts)
php artisan role:assign-all-permissions admin --force
# With specific guard
php artisan role:assign-all-permissions admin --guard=apiShows:
- Role information
- List of all permissions that will be assigned (grouped by module)
- Applied filters
- Summary: newly assigned, already assigned, and total permissions
php artisan role:assign-all-permissions super-admin --forcephp artisan role:assign-all-permissions manager --module=usersphp artisan role:assign-all-permissions viewer --action=readphp artisan role:show admin --with-usersphp artisan user:show john@example.comphp artisan module:show users --with-rolesphp artisan permissions:list --role=editorphp artisan permissions:list --module=users# Sync permissions from your controllers
php artisan permissions:sync --preview
php artisan permissions:sync
# Create roles
php artisan role:create admin
php artisan role:create editor
php artisan role:create viewer# Option A: Assign one by one
php artisan role:assign-permission admin users create
php artisan role:assign-permission admin users read
php artisan role:assign-permission admin users update
php artisan role:assign-permission admin users delete
# Option B: Assign all at once (faster!)
php artisan role:assign-all-permissions admin --module=users
# Option C: Give admin EVERYTHING
php artisan role:assign-all-permissions admin --force# Verify the role has the right permissions
php artisan role:show admin
# Verify a module has the right access
php artisan module:show users --with-roles$user = User::find(1);
$user->assignRole('admin');php artisan user:show 1# Always sync after creating new controllers
php artisan permissions:syncphp artisan module:show admin --with-roles
php artisan module:show users --with-rolesphp artisan user:show admin@example.comUser → has many → Roles
Role → has many → Permissions
Permission = Module + Action
Examples:
- User "John" → Role "admin" → Permission "users.create"
- Permission "users.create" = Module "users" + Action "create"
Use the commands to explore these relationships:
user:show- Start from a user, see their roles and permissionsrole:show- Start from a role, see its permissions and usersmodule:show- Start from a module, see its actions and which roles have access