47 lines
975 B
PHP
47 lines
975 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class ProjektObjekteImDetail extends Model
|
|
{
|
|
protected $fillable = [
|
|
'projekte_id',
|
|
'projekt_objekte_id',
|
|
'methode_id',
|
|
'top_nummer',
|
|
'geschoss',
|
|
'raumart',
|
|
'faktor',
|
|
'flaeche',
|
|
'nutzwert',
|
|
];
|
|
|
|
public static function boot()
|
|
{
|
|
parent::boot();
|
|
|
|
self::updated(function ($model) {
|
|
Projekte::where('id', $model['projekte_id'])->update([
|
|
'evaluation_gutachten' => false,
|
|
]);
|
|
});
|
|
}
|
|
|
|
public function top_nummer()
|
|
{
|
|
return $this->belongsTo(ProjektObjekte::class, 'projekt_objekte_id', 'id');
|
|
}
|
|
|
|
public function merkmale()
|
|
{
|
|
return $this->hasOne(ProjektMerkmale::class, 'raumart', 'raumart');
|
|
}
|
|
|
|
public function methode()
|
|
{
|
|
return $this->belongsTo(ProjektMethode::class, 'raumart', 'raumart');
|
|
}
|
|
}
|