diff --git a/app/Models/User.php b/app/Models/User.php index 7cde9214..584e95bc 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -5,6 +5,7 @@ use App\Notifications\PasswordResetQueuedNotification; use App\Notifications\UpdateEmailNotification; use App\Notifications\VerifyEmailQueuedNotification; +use Filament\Models\Contracts\FilamentUser; use Illuminate\Contracts\Auth\MustVerifyEmail; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Foundation\Auth\User as Authenticatable; @@ -16,7 +17,7 @@ use Spatie\Permission\Traits\HasRoles; use Vinkla\Hashids\Facades\Hashids; -class User extends Authenticatable implements MustVerifyEmail +class User extends Authenticatable implements MustVerifyEmail, FilamentUser { use HasFactory; use Notifiable; @@ -120,4 +121,9 @@ public function scopeCheck(string $ability) $appCheck = $this->appCan($ability); return ($sanctumCheck && $appCheck); } + + public function canAccessFilament(): bool + { + return $this->hasRole('superadmin'); + } }