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:
co-authored by
Claude Opus 5.5
parent
ca09d23a78
commit
6aac8b0a16
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Enums\Land;
|
||||
use App\Models\Concerns\ErbtZuordnung;
|
||||
use Carbon\CarbonImmutable;
|
||||
use Database\Factories\AbschnittFactory;
|
||||
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
||||
use Illuminate\Database\Eloquent\Attributes\Table;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
/**
|
||||
* Abschnitt eines Projekts, im Bahnbau meist ein PFA (Planfeststellungsabschnitt).
|
||||
* Wie er in der Oberfläche heißt, steht am Projekt (abschnitt_bezeichnung).
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $mandant_id
|
||||
* @property Land $land
|
||||
* @property int $projekt_id
|
||||
* @property string $bezeichnung
|
||||
* @property int $sortierung
|
||||
* @property CarbonImmutable|null $created_at
|
||||
* @property CarbonImmutable|null $updated_at
|
||||
*/
|
||||
#[Table('abschnitte')]
|
||||
#[Fillable(['projekt_id', 'bezeichnung', 'sortierung'])]
|
||||
class Abschnitt extends Model
|
||||
{
|
||||
/** @use HasFactory<AbschnittFactory> */
|
||||
use ErbtZuordnung, HasFactory;
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'land' => Land::class,
|
||||
];
|
||||
}
|
||||
|
||||
protected function zuordnungsEltern(): ?Model
|
||||
{
|
||||
return $this->projekt()->first();
|
||||
}
|
||||
|
||||
/** @return BelongsTo<Projekt, $this> */
|
||||
public function projekt(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Projekt::class);
|
||||
}
|
||||
|
||||
/** @return HasMany<Vertrag, $this> */
|
||||
public function vertraege(): HasMany
|
||||
{
|
||||
return $this->hasMany(Vertrag::class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user