*/ use HasFactory, Notifiable; /** * 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', ]; /** * 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', ]; } /** * 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; } /** * 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}"), ); } }