126 lines
2.7 KiB
PHP
126 lines
2.7 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Models\Scopes\KontoScope;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Projekte extends Model
|
|
{
|
|
use \Bkwld\Cloner\Cloneable;
|
|
|
|
protected $cloneable_relations = [
|
|
'projekt_objekte',
|
|
'projekt_platzhalters',
|
|
'projekt_allgemeinflaechens',
|
|
'projekt_raeumealles',
|
|
'projekt_methodes',
|
|
'projekt_inhaltsverzeichnis',
|
|
'projekt_merkmale',
|
|
];
|
|
|
|
protected $primaryKey = 'id';
|
|
|
|
protected $fillable = [
|
|
'id',
|
|
'konto_id',
|
|
'auftraggeber_id',
|
|
'gutachter_id',
|
|
'interner_name',
|
|
'offizieller_name',
|
|
'ort',
|
|
'beschreibung',
|
|
'erstellung',
|
|
'status',
|
|
'projekt_farben_verwenden',
|
|
'deckblatt_bg',
|
|
'schmuckfarbe_header',
|
|
'farbe_borders',
|
|
'evaluation_gutachten',
|
|
'pdf_nutzwerte_tabellen_umbruch',
|
|
'bezahlt_am',
|
|
'created_at',
|
|
'updated_at',
|
|
'deleted_at',
|
|
];
|
|
|
|
/**
|
|
* Get the attributes that should be cast.
|
|
*
|
|
* @return array<string, string>
|
|
*/
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'bezahlt_am' => 'datetime',
|
|
'evaluation_gutachten' => 'boolean',
|
|
'projekt_farben_verwenden' => 'boolean',
|
|
];
|
|
}
|
|
|
|
public function projekt_users()
|
|
{
|
|
return $this->belongsToMany(Projekte::class, 'projekt_users', 'projekte_id', 'user_id');
|
|
}
|
|
|
|
protected static function booted(): void
|
|
{
|
|
static::addGlobalScope(new KontoScope);
|
|
}
|
|
|
|
public function projekt_objekte()
|
|
{
|
|
return $this->hasMany(ProjektObjekte::class);
|
|
}
|
|
|
|
public function projekt_merkmale()
|
|
{
|
|
return $this->hasMany(ProjektMerkmale::class);
|
|
}
|
|
|
|
public function auftraggeber()
|
|
{
|
|
return $this->belongsTo(Auftraggeber::class);
|
|
}
|
|
|
|
public function projekt_platzhalters()
|
|
{
|
|
return $this->hasMany(ProjektPlatzhalter::class);
|
|
}
|
|
|
|
public function gutachter()
|
|
{
|
|
return $this->belongsTo(Gutachter::class);
|
|
}
|
|
|
|
public function projekt_allgemeinflaechens()
|
|
{
|
|
return $this->hasMany(ProjektAllgemeinflaechen::class);
|
|
}
|
|
|
|
public function projekt_raeumealles()
|
|
{
|
|
return $this->hasMany(ProjektObjekteImDetail::class);
|
|
}
|
|
|
|
public function projekt_methodes()
|
|
{
|
|
return $this->hasMany(ProjektMethode::class);
|
|
}
|
|
|
|
public function file_imports()
|
|
{
|
|
return $this->hasMany(FileImport::class);
|
|
}
|
|
|
|
public function projekt_inhaltsverzeichnis()
|
|
{
|
|
return $this->hasMany(ProjektInhaltsverzeichnis::class);
|
|
}
|
|
|
|
public function konto_textblocks()
|
|
{
|
|
return $this->hasMany(KontoTextblock::class);
|
|
}
|
|
}
|