Larasonic uses Jetstreamβs simple RBAC (Role-Based Access Control) implementation. While not as feature-rich as dedicated packages like Spatie Permissions, it provides a straightforward way to manage team-based roles and permissions.
For more detailed information and advanced usage, visit the Laravel Jetstream
Each team member can be assigned a role, and each role has specific permissions. Roles and permissions are defined in App\Providers\JetstreamServiceProvider.
Copy
Jetstream::defaultApiTokenPermissions(['read']);Jetstream::role('admin', 'Administrator', [ 'create', 'read', 'update', 'delete',])->description('Administrator users can perform any action.');Jetstream::role('editor', 'Editor', [ 'read', 'create', 'update',])->description('Editors can read, create and update content.');
You can check permissions using the methods provided by the HasTeams trait:
Copy
// Check if user has specific permission$user->hasTeamPermission($team, 'create');// Get user's role on team$user->teamRole($team);// Check if user has specific role$user->hasTeamRole($team, 'admin');
Need a more robust roles and permissions system? Vote for enhanced RBAC features in our roadmap.
The current implementation is suitable for basic team-based permission scenarios. For complex permission requirements, consider implementing a dedicated package like Spatie Permissions.