Datenmodell Kern: Projekt, PFA, Vertrag, LV, Nachtrag, Dokument

- Mandant, Auftragnehmer, Projekt mit Suchreihenfolge, Abschnitt (PFA), Vertrag,
  Leistungsverzeichnis, Nachtrag (MKA nur als Bezug), Nachtragsposition, Dokument
- Projektmitglieder mit Projektrolle, Freigaben für vertrauliche Dokumente
- Mandant, Land und Projekt werden vom übergeordneten Datensatz übernommen;
  Fehlzuordnungen über Mandanten oder Projekte hinweg werden abgewiesen
- Feste Morph-Map, Factories, Demodaten (Musterbahn, PFA 1–4, N14/N16/N21), Tests

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Christoph
2026-10-05 08:34:24 +02:00
co-authored by Claude Opus 5.5
parent ca09d23a78
commit 6aac8b0a16
37 changed files with 1855 additions and 2 deletions
+21
View File
@@ -7,6 +7,8 @@ use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Attributes\Fillable;
use Illuminate\Database\Eloquent\Attributes\Hidden;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Illuminate\Support\Carbon;
@@ -18,6 +20,7 @@ use Spatie\Permission\Traits\HasRoles;
/**
* @property int $id
* @property int|null $mandant_id
* @property string $name
* @property string $email
* @property string|null $locale
@@ -50,6 +53,24 @@ class User extends Authenticatable implements MustVerifyEmail, PasskeyUser
];
}
/** @return BelongsTo<Mandant, $this> */
public function mandant(): BelongsTo
{
return $this->belongsTo(Mandant::class);
}
/**
* Projekte, in denen der Benutzer Mitglied ist; die Projektrolle steht im Pivot (rolle).
*
* @return BelongsToMany<Projekt, $this>
*/
public function projekte(): BelongsToMany
{
return $this->belongsToMany(Projekt::class, 'projekt_mitglieder')
->withPivot('rolle')
->withTimestamps();
}
/**
* Get the user's initials
*/