- 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>
63 lines
1.7 KiB
PHP
63 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Enums\Land;
|
|
use App\Models\Concerns\ErbtZuordnung;
|
|
use Carbon\CarbonImmutable;
|
|
use Database\Factories\NachtragspositionFactory;
|
|
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;
|
|
|
|
/**
|
|
* Position eines Nachtrags-LV. Der Einheitspreis ist in Phase 1 nur Information.
|
|
*
|
|
* @property int $id
|
|
* @property int $mandant_id
|
|
* @property Land $land
|
|
* @property int $projekt_id
|
|
* @property int $nachtrag_id
|
|
* @property string $oz
|
|
* @property string $kurztext
|
|
* @property string|null $langtext
|
|
* @property string|null $menge
|
|
* @property string|null $einheit
|
|
* @property string|null $einheitspreis
|
|
* @property int $sortierung
|
|
* @property CarbonImmutable|null $created_at
|
|
* @property CarbonImmutable|null $updated_at
|
|
*/
|
|
#[Table('nachtragspositionen')]
|
|
#[Fillable(['nachtrag_id', 'oz', 'kurztext', 'langtext', 'menge', 'einheit', 'einheitspreis', 'sortierung'])]
|
|
class Nachtragsposition extends Model
|
|
{
|
|
/** @use HasFactory<NachtragspositionFactory> */
|
|
use ErbtZuordnung, HasFactory;
|
|
|
|
/**
|
|
* @return array<string, string>
|
|
*/
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'land' => Land::class,
|
|
'menge' => 'decimal:3',
|
|
'einheitspreis' => 'decimal:2',
|
|
];
|
|
}
|
|
|
|
protected function zuordnungsEltern(): ?Model
|
|
{
|
|
return $this->nachtrag()->first();
|
|
}
|
|
|
|
/** @return BelongsTo<Nachtrag, $this> */
|
|
public function nachtrag(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Nachtrag::class);
|
|
}
|
|
}
|