Skip to content

Commit

Permalink
feat(models): add FilamentUser support to User model
Browse files Browse the repository at this point in the history
-Added `FilamentUser` interface implementation to the `User` model, enabling compatibility with Filament.
-Introduced `canAccessPanel` method returning true by default.
  • Loading branch information
frederic moras committed Dec 31, 2024
1 parent f0bccc5 commit 21b6909
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions app/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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*/;

Expand Down Expand Up @@ -72,4 +74,9 @@ protected function casts(): array
'password' => 'hashed',
];
}

public function canAccessPanel( Panel $panel): bool
{
return true;
}
}

0 comments on commit 21b6909

Please sign in to comment.