*/ use HasFactory; use HasFile; use HasRoles; use HasUlids; use HasApiTokens; use Notifiable; use \OwenIt\Auditing\Auditable; /** * Cast attributes * * @var array */ protected $casts = [ 'email_verified_at' => 'datetime', 'password' => 'hashed', 'settings' => 'collection', 'status' => UserStatus::class, ]; /** * Attributes to include in the Audit. */ protected array $auditInclude = [ 'name', 'email', 'status', ]; protected static function newFactory(): Factory { return UserFactory::new(); } public function sendPasswordResetNotification($token): void { // This overrides the default CanResetPassword trait method $this->notify(new ResetPasswordNotification($token)); } public function sendEmailVerificationNotification(): void { $this->notify(new VerifyEmailNotification); } public function uniqueIds(): array { return ['ulid']; } public function getRoleNameAttribute() { return $this->roles->first()->name ?? '-'; } public function avatar(): MorphOne { return $this->hasSingleFile('avatar'); } public function profile(): HasOne { return $this->hasOne(Profile::class); } }