*/ use HasFactory, Notifiable; use InteractsWithAppAuthentication; use InteractsWithAppAuthenticationRecovery; protected function casts(): array { return [ 'email_verified_at' => 'datetime', 'password' => 'hashed', 'confirmed_adult_at' => 'datetime', 'status' => AccountStatus::class, ]; } public function party(): BelongsTo { return $this->belongsTo(Party::class); } public function staffRoles(): HasMany { return $this->hasMany(StaffRoleAssignment::class); } public function hasStaffRole(StaffRole $role): bool { if ($this->relationLoaded('staffRoles')) { return $this->staffRoles->contains(fn (StaffRoleAssignment $assignment): bool => $assignment->role === $role); } return $this->staffRoles()->where('role', $role->value)->exists(); } public function canAccessPanel(Panel $panel): bool { return $this->status === AccountStatus::Aktiv && $this->hasVerifiedEmail() && $this->staffRoles()->exists(); } }