File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change 5
5
use App \Concerns \HasTimestamps ;
6
6
use App \Concerns \PreparesSearch ;
7
7
use App \Enums \NotificationType ;
8
+ use App \Policies \UserPolicy ;
8
9
use Carbon \Carbon ;
10
+ use Filament \Facades \Filament ;
11
+ use Filament \Models \Contracts \FilamentUser ;
12
+ use Filament \Panel ;
9
13
use Illuminate \Contracts \Auth \MustVerifyEmail ;
10
14
use Illuminate \Database \Eloquent \Builder ;
11
15
use Illuminate \Database \Eloquent \Factories \HasFactory ;
17
21
use Laravel \Sanctum \HasApiTokens ;
18
22
use Laravel \Scout \Searchable ;
19
23
20
- final class User extends Authenticatable implements MustVerifyEmail
24
+ final class User extends Authenticatable implements MustVerifyEmail, FilamentUser
21
25
{
22
26
use HasApiTokens;
23
27
use HasFactory;
@@ -410,4 +414,11 @@ public function isNotificationAllowed(string $notification): bool
410
414
return NotificationType::from ($ notificationType )->getClass () === $ notification ;
411
415
});
412
416
}
417
+
418
+ public function canAccessPanel (Panel $ panel ): bool
419
+ {
420
+ $ guard = Filament::getAuthGuard ();
421
+
422
+ return Auth::guard ($ guard )->user ()->can (UserPolicy::ADMIN , User::class);
423
+ }
413
424
}
You can’t perform that action at this time.
0 commit comments