*/ use HasFactory, Notifiable, TwoFactorAuthenticatable; /** * The attributes that are mass assignable. * * @var list */ protected $fillable = [ 'username', 'first_name', 'last_name', 'email', 'password', ]; /** * The attributes that should be hidden for serialization. * * @var list */ protected $hidden = [ 'password', 'remember_token', 'two_factor_secret', 'two_factor_recovery_codes', ]; /** * The accessors to append to the model's array form. * * @var list */ protected $appends = [ 'full_name', ]; /** * Get the attributes that should be cast. * * @return array */ protected function casts(): array { return [ 'email_verified_at' => 'datetime', 'password' => 'hashed', 'two_factor_confirmed_at' => 'datetime', 'auth_session_version' => 'integer', ]; } /** * Only send verification notification when the feature is enabled. */ public function sendEmailVerificationNotification(): void { if (config('auth-ui.features.email_verification')) { parent::sendEmailVerificationNotification(); } } /** * Check if the user has a password set (i.e. not a social-only user). */ public function hasPassword(): bool { return $this->password !== null; } /** * Queue password reset mail so the request does not reveal account * existence through mail-delivery timing. */ public function sendPasswordResetNotification($token): void { $this->notify(new QueuedResetPasswordNotification($token)); } /** * Get the user's social accounts. */ public function socialAccounts(): HasMany { return $this->hasMany(SocialAccount::class); } /** * Get the user's full name. */ protected function fullName(): Attribute { return Attribute::make( get: fn () => trim("{$this->first_name} {$this->last_name}"), ); } }