Vincenzo Collica
Authorizing access to the panel
class User extends Authenticatable implements MustVerifyEmail, FilamentUser
{
use HasApiTokens, HasFactory, Notifiable;
/
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = [
'name',
'email',
'password',
];
/
* The attributes that should be hidden for serialization.
*
* @var array<int, string>
*/
protected $hidden = [
'password',
'remember_token',
];
/**
* The attributes that should be cast.
*
* @var array<string, string>
*/
protected $casts = [
'email_verified_at' => 'datetime',
'password' => 'hashed',
];
public function canAccessPanel(Panel $panel): bool
{
if ($this->is_verified == 1 && $this->hasVerifiedEmail()) {
return true;
} else if ($this->is_verified == 0 && $this->hasVerifiedEmail()) {
Notification::make()
->title('Attenzione')
->body("Al momento non hai ancora ricevuto l'autorizzazione per accedere alla piattaforma. Ti preghiamo di attendere prima di essere abilitato.")
->color('danger')
->danger()
->seconds(10)
->send();
Auth::logout();
}
return true;
}
}
9 replies
Request for information on the documentation
One last piece of advice, please. I have used Laravel's Fortify authentication system, which I find comprehensive. I've seen that Filament has its own system, but it seems incomplete. Can I integrate it or use the Fortify package of Laravel with Filament
12 replies