88 lines
1.9 KiB
PHP
88 lines
1.9 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
use Illuminate\Database\Eloquent\Relations\HasOne;
|
|
|
|
/**
|
|
* @property int $id
|
|
* @property int $projekte_id
|
|
* @property int $cloned_from_id
|
|
* @property int $added_manuel
|
|
* @property int $orientierung_id
|
|
* @property int $nicht_in_orientierung
|
|
* @property string $top_nummer
|
|
* @property string $type
|
|
* @property string $raumart
|
|
* @property string $nutzwert
|
|
* @property string $a
|
|
* @property string $b
|
|
* @property string $c
|
|
* @property string $d
|
|
* @property string $e
|
|
* @property string $f
|
|
* @property string $g
|
|
* @property string $h
|
|
* @property string $i
|
|
* @property string $j
|
|
*/
|
|
class ProjektObjekte extends Model
|
|
{
|
|
protected $fillable = [
|
|
'projekte_id',
|
|
'cloned_from_id',
|
|
'added_manuel',
|
|
'orientierung_id',
|
|
'nicht_in_orientierung',
|
|
'top_nummer',
|
|
'type',
|
|
'raumart',
|
|
'nutzwert',
|
|
'a',
|
|
'b',
|
|
'c',
|
|
'd',
|
|
'e',
|
|
'f',
|
|
'g',
|
|
'h',
|
|
'i',
|
|
'j',
|
|
];
|
|
|
|
public static function boot()
|
|
{
|
|
parent::boot();
|
|
|
|
self::updated(function ($model) {
|
|
Projekte::where('id', $model['projekte_id'])->update([
|
|
'evaluation_gutachten' => false,
|
|
]);
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Get the attributes that should be cast.
|
|
*
|
|
* @return array<string, string>
|
|
*/
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'nicht_in_orientierung' => 'boolean',
|
|
];
|
|
}
|
|
|
|
public function orientierung(): HasOne
|
|
{
|
|
return $this->hasOne(Orientierung::class, 'id', 'orientierung_id');
|
|
}
|
|
|
|
public function projektobjekteimdetail(): HasMany
|
|
{
|
|
return $this->hasMany(ProjektObjekteImDetail::class, 'projekt_objekte_id', 'id');
|
|
}
|
|
}
|