*/ use HasFactory, HasUuids, Notifiable, PasskeyAuthenticatable, TwoFactorAuthenticatable; /** @return list */ public function uniqueIds(): array { return ['uuid']; } /** @return BelongsToMany */ public function roles(): BelongsToMany { return $this->belongsToMany(Role::class); } /** @return HasMany */ public function reservations(): HasMany { return $this->hasMany(Reservation::class, 'requester_id'); } /** @return HasMany */ public function externalIdentities(): HasMany { return $this->hasMany(ExternalIdentity::class); } public function hasRole(RoleName|string $role): bool { $name = $role instanceof RoleName ? $role->value : $role; return $this->roles()->where('name', $name)->exists(); } /** * 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', 'active' => 'boolean', 'last_login_at' => 'datetime', ]; } }