inertia start
Features

Roles & Permissions

Manage application-wide roles and permissions independently of team membership.

Inertia Start uses Spatie Laravel Permission for application-wide roles and permissions. User uses its HasRoles trait, so applications can define their own roles and assign permissions directly or through roles. This works whether or not Teams is enabled.

How admin access works

App\Enums\SystemRole names the starter's built-in roles in Spatie's tables. There is no separate users.system_role column.

RoleAccess
Admin (admin)Access to the admin area.
Super Admin (super_admin)Admin area access plus the Horizon and Telescope gates. Super Admins also receive security abuse alerts.
Neither built-in roleRegular application access, plus any custom permissions assigned by your application.

The is_admin attribute checks for either built-in role. The admin middleware checks that attribute on protected routes. A custom role does not grant admin access by itself.

Super Admin access to Horizon and Telescope is granted through explicit gates. There is no blanket Super Admin bypass of gates or resource policies.

Assign a platform role

The setup flow generates a secure link to create the first Super Admin, creating its role when necessary. To change the platform role of an existing active user, run:

php artisan inertia-start:set-system-role [email protected] admin
php artisan inertia-start:set-system-role [email protected] super_admin
php artisan inertia-start:set-system-role [email protected] none

The command changes only the two built-in roles and preserves custom roles and direct permissions. none removes built-in administrator access; it does not clear application-specific assignments.

The command protects the last Super Admin from role removal or downgrade, and the account deletion flow protects that account from deletion. Assign another Super Admin before changing it. Direct Spatie API calls are lower-level operations, so use the application command when changing built-in administrator roles.

Add application roles and permissions

Create roles and permissions with Spatie's APIs. For example, for the application's web guard:

use Spatie\Permission\Models\Permission;
use Spatie\Permission\Models\Role;

$permission = Permission::findOrCreate('publish articles', 'web');
$editor = Role::findOrCreate('editor', 'web');
$editor->givePermissionTo($permission);
$user->assignRole($editor);

$user->hasRole('editor');
$user->can('publish articles');

A context-free check such as $user->can('publish articles') resolves assigned permissions when no explicit gate has decided the result. Direct permission assignments with $user->givePermissionTo($permission) are also supported. Prefer grouping related permissions in roles when that fits your application.

Authorize resources with policies

Checks with resource arguments, such as $user->can('update', $project), always reach the resource's policy. A global permission named update cannot skip that check. Explicit gate decisions also take precedence over permission assignments.

config/permission.php disables Spatie's automatic Gate hook (register_permission_check_method=false). AppServiceProvider supplies a context-free permission fallback through Gate::after. Keep this integration when extending authorization; re-enabling the package's automatic hook would let a matching global permission run before a resource policy.

For a team-owned resource, check ownership or membership using the resource's stored team before applying any additional permission rules. A policy may then use $user->hasPermissionTo('publish articles') if the action also requires an application permission. An application's global role or permission does not establish team membership.

Spatie's team permission mode stays disabled (permission.teams=false). Inertia Start's team owner and membership roles are independent records, resolved explicitly for the requested team. See Teams for a complete resource-policy example.

Use Laravel gates and policies and the Spatie documentation when extending the authorization model.

On this page