Core Concepts

Users

All you need to add is the following lines to your User model:

    
1use Filament\Models\Contracts\FilamentUser;
2use Filament\Panel;
3use Illuminate\Foundation\Auth\User as Authenticatable;
4use Illuminate\Notifications\Notifiable;
5use Spatie\Permission\Traits\HasRoles;
6 
7class User extends Authenticatable implements FilamentUser
8{
9 use HasRoles;
10 use Notifiable;
11 
12 public function canAccessPanel(Panel $panel): bool
13 {
14 return $this->hasAnyRole(['Super Admin', 'Admin', 'Editor', 'Viewer']);
15 }
16}
Previous
Page Builder
Code highlighting provided by Torchlight