gestione gare pubbliche
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 
 

83 righe
1.9 KiB

<?php
namespace App\Models\Main;
use App\Models\Main\Pec;
use App\Models\Main\Utenti;
use Illuminate\Database\Eloquent\Model;
use App\Models\Main\Messaggi;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Relations\HasManyThrough;
class Comunicazioni extends Model
{
use HasFactory;
/**
* The connection name for the model.
*
* @var string|null
*/
protected $connection = "mysql";
/**
* The table associated with the model.
*
* @var string
*/
protected $table = "b_comunicazioni";
/**
* The primary key for the model.
*
* @var string
*/
protected $primaryKey = 'codice';
/**
* The name of the "created at" column.
*
* @var string|null
*/
const CREATED_AT = 'timestamp_creazione';
/**
* The name of the "updated at" column.
*
* @var string|null
*/
const UPDATED_AT = 'timestamp';
/**
* Ottieni tutti gli utenti per la Comunicazione
*
* @return \Illuminate\Database\Eloquent\Relations\HasManyThrough
*/
public function utenti(): HasManyThrough
{
return $this->hasManyThrough(Utenti::class, Messaggi::class, "codice_comunicazione", "codice_utente", "codice", "codice");
}
/**
* Ottieni la pec di riferimento per la comunicazione
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function pec(): BelongsTo
{
return $this->belongsTo(Pec::class, 'codice_pec', 'codice');
}
/**
* Get all of the comunicazioni per utente for the Comunicazioni
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function messaggi(): HasMany
{
return $this->hasMany(Messaggi::class, 'codice_comunicazione', 'codice');
}
}