Skip to content

Authorization

KroderDev edited this page Jul 1, 2025 · 3 revisions

The package integrates with Laravel's Gate, enabling Blade directives to check roles and permissions.

@can('posts.create')
    <!-- user can create posts -->
@endcan

@cannot('permission:posts.delete')
    <!-- no delete rights -->
@endcannot

@canany(['role:admin', 'permission:posts.update'])
    <!-- admin or user with update permission -->
@endcanany

Use hasRole and hasPermissionTo methods on the authenticated user for programmatic checks:

if (auth()->user()->hasRole('admin')) {
    // ...
}

JWT Tokens and the Gateway Guard

Authentication is handled via JWT tokens validated by the JWT Authentication middleware or by the session-based Gateway Guard.

Refer to the linked pages for configuration details.

Clone this wiki locally