67 lines
1.4 KiB
PHP
Executable File
67 lines
1.4 KiB
PHP
Executable File
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Convocazione extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $table = 'assemblee_convocazioni';
|
|
|
|
protected $fillable = [
|
|
'assemblea_id',
|
|
'soggetto_id',
|
|
'unita_immobiliare_id',
|
|
'ruolo',
|
|
'consegnato_canale',
|
|
'consegnato_at',
|
|
'ricezione_confermata_at',
|
|
'token_accesso',
|
|
];
|
|
|
|
protected $casts = [
|
|
'consegnato_at' => 'datetime',
|
|
'ricezione_confermata_at' => 'datetime',
|
|
'created_at' => 'datetime',
|
|
'updated_at' => 'datetime',
|
|
];
|
|
|
|
/**
|
|
* Relazione con Assemblea
|
|
*/
|
|
public function assemblea()
|
|
{
|
|
return $this->belongsTo(Assemblea::class, 'assemblea_id');
|
|
}
|
|
|
|
/**
|
|
* Relazione con Soggetto destinatario
|
|
*/
|
|
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');
|
|
}
|
|
|
|
/**
|
|
* Conferma lettura/ricezione
|
|
*/
|
|
public function confermaLettura()
|
|
{
|
|
$this->update([
|
|
'ricezione_confermata_at' => now(),
|
|
]);
|
|
|
|
return $this;
|
|
}
|
|
} |