64 lines
1.4 KiB
PHP
64 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class AssembleaPresenza extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $table = 'assemblee_presenze';
|
|
|
|
protected $fillable = [
|
|
'assemblea_id',
|
|
'soggetto_id',
|
|
'unita_immobiliare_id',
|
|
'tipo_partecipazione',
|
|
'delegato_soggetto_id',
|
|
'ora_ingresso',
|
|
'ora_uscita',
|
|
'qr_code_token',
|
|
];
|
|
|
|
protected $casts = [
|
|
'ora_ingresso' => 'datetime',
|
|
'ora_uscita' => 'datetime',
|
|
'created_at' => 'datetime',
|
|
'updated_at' => 'datetime',
|
|
];
|
|
|
|
/**
|
|
* Relazione con Assemblea
|
|
*/
|
|
public function assemblea()
|
|
{
|
|
return $this->belongsTo(Assemblea::class, 'assemblea_id');
|
|
}
|
|
|
|
/**
|
|
* Relazione con Soggetto presente (condomino)
|
|
*/
|
|
public function soggetto()
|
|
{
|
|
return $this->belongsTo(Soggetto::class, 'soggetto_id', 'id');
|
|
}
|
|
|
|
/**
|
|
* Relazione con Unità Immobiliare
|
|
*/
|
|
public function unitaImmobiliare()
|
|
{
|
|
return $this->belongsTo(UnitaImmobiliare::class, 'unita_immobiliare_id', 'id');
|
|
}
|
|
|
|
/**
|
|
* Relazione con Soggetto delegato (se tipo_partecipazione è 'delega')
|
|
*/
|
|
public function delegatoSoggetto()
|
|
{
|
|
return $this->belongsTo(Soggetto::class, 'delegato_soggetto_id', 'id');
|
|
}
|
|
}
|