πŸ”‘ Roles & Permissions

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

πŸ› οΈ Current Implementation

Each team member can be assigned a role, and each role has specific permissions. Roles and permissions are defined in App\Providers\JetstreamServiceProvider.

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.');

βœ… Checking Permissions

You can check permissions using the methods provided by the HasTeams trait:

// 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');

πŸ”„ Looking for More?

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.