*/ use HasFactory, HasRoles, Notifiable, PasskeyAuthenticatable, TwoFactorAuthenticatable; /** * Get the attributes that should be cast. * * @return array */ protected function casts(): array { return [ 'email_verified_at' => 'datetime', 'password' => 'hashed', ]; } /** @return BelongsTo */ public function mandant(): BelongsTo { return $this->belongsTo(Mandant::class); } /** * Projekte, in denen der Benutzer Mitglied ist; die Projektrolle steht im Pivot (rolle). * * @return BelongsToMany */ public function projekte(): BelongsToMany { return $this->belongsToMany(Projekt::class, 'projekt_mitglieder') ->withPivot('rolle') ->withTimestamps(); } /** * Get the user's initials */ public function initials(): string { $initials = Str::initials($this->name, true); return Str::length($initials) > 1 ? Str::substr($initials, 0, 1).Str::substr($initials, -1) : $initials; } }