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.
 
 
 
 
 

89 righe
1.8 KiB

<?php
namespace App\Models\Tenant\Conservazione;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class Conservazione extends Model
{
use HasFactory;
/**
* The connection name for the model.
*
* @var string|null
*/
protected $connection = "mysql-tenant";
/**
* The table associated with the model.
*
* @var string
*/
protected $table = "b_conservazione";
/**
* The attributes that are mass assignable.
*
* @var string[]
*/
protected $fillable = [
'modulo',
'tipologia',
'codice_elemento',
'codice_ente'
];
/**
* 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';
/**
* Get all of the files for the Conservazione
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function items(): HasMany
{
return $this->hasMany(\App\Models\Tenant\Conservazione\File::class, 'codice_conservazione', 'codice');
}
/**
* Get the object that owns the Conservazione
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function object(): ?BelongsTo
{
switch($this->modulo) {
case 'gare':
return $this->belongsTo(\App\Models\Tenant\Gare\Gara::class, 'codice_elemento', 'codice');
default:
return null;
}
}
}