- 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>
54 lines
1.3 KiB
PHP
54 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Enums\Land;
|
|
use Carbon\CarbonImmutable;
|
|
use Database\Factories\AuftragnehmerFactory;
|
|
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;
|
|
|
|
/**
|
|
* Baufirma oder ARGE. Kann in mehreren Abschnitten eines Projekts Verträge haben.
|
|
*
|
|
* @property int $id
|
|
* @property int $mandant_id
|
|
* @property Land $land
|
|
* @property string $name
|
|
* @property CarbonImmutable|null $created_at
|
|
* @property CarbonImmutable|null $updated_at
|
|
*/
|
|
#[Table('auftragnehmer')]
|
|
#[Fillable(['mandant_id', 'land', 'name'])]
|
|
class Auftragnehmer extends Model
|
|
{
|
|
/** @use HasFactory<AuftragnehmerFactory> */
|
|
use HasFactory;
|
|
|
|
/**
|
|
* @return array<string, string>
|
|
*/
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'land' => Land::class,
|
|
];
|
|
}
|
|
|
|
/** @return BelongsTo<Mandant, $this> */
|
|
public function mandant(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Mandant::class);
|
|
}
|
|
|
|
/** @return HasMany<Vertrag, $this> */
|
|
public function vertraege(): HasMany
|
|
{
|
|
return $this->hasMany(Vertrag::class);
|
|
}
|
|
}
|