From 21b690955e4e08d4f11c6eab0c37817c8c51e28a Mon Sep 17 00:00:00 2001 From: frederic moras Date: Tue, 31 Dec 2024 15:15:56 +0100 Subject: [PATCH] feat(models): add FilamentUser support to User model -Added `FilamentUser` interface implementation to the `User` model, enabling compatibility with Filament. -Introduced `canAccessPanel` method returning true by default. --- app/Models/User.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app/Models/User.php b/app/Models/User.php index 948b39a..bfcb35f 100755 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -3,13 +3,15 @@ namespace App\Models; // use Illuminate\Contracts\Auth\MustVerifyEmail; +use Filament\Models\Contracts\FilamentUser; +use Filament\Panel; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Foundation\Auth\User as Authenticatable; use Illuminate\Notifications\Notifiable; //use Laravel\Sanctum\HasApiTokens; /** - * + * * * @property int $id * @property string $name @@ -35,7 +37,7 @@ * @method static \Illuminate\Database\Eloquent\Builder|User whereUpdatedAt($value) * @mixin \Eloquent */ -class User extends Authenticatable +class User extends Authenticatable implements FilamentUser { use HasFactory, Notifiable/*, HasApiTokens*/; @@ -72,4 +74,9 @@ protected function casts(): array 'password' => 'hashed', ]; } + + public function canAccessPanel( Panel $panel): bool + { + return true; + } }