*/ use HasFactory, Notifiable, SoftDeletes; /** * The attributes that are mass assignable. * * @var list */ protected $fillable = [ 'username', 'username_changed_at', 'onboarding_step', 'name', 'email', 'last_verification_sent_at', 'verification_send_count_24h', 'verification_send_window_started_at', 'is_active', 'needs_password_reset', 'password', 'role', ]; /** * The attributes that should be hidden for serialization. * * @var list */ protected $hidden = [ 'password', 'remember_token', ]; /** * Get the attributes that should be cast. * * @return array */ protected function casts(): array { return [ 'email_verified_at' => 'datetime', 'last_verification_sent_at' => 'datetime', 'verification_send_window_started_at' => 'datetime', 'verification_send_count_24h' => 'integer', 'username_changed_at' => 'datetime', 'deleted_at' => 'datetime', 'password' => 'hashed', ]; } public function artworks(): HasMany { return $this->hasMany(Artwork::class); } public function profile(): HasOne { return $this->hasOne(UserProfile::class, 'user_id'); } public function hasRole(string $role): bool { return strtolower((string) ($this->role ?? '')) === strtolower($role); } public function isAdmin(): bool { return $this->hasRole('admin'); } public function isModerator(): bool { return $this->hasRole('moderator'); } }