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.
70 righe
1.3 KiB
70 righe
1.3 KiB
<?php |
|
|
|
namespace App\Models\Main; |
|
|
|
use App\Models\Main\Pec; |
|
use App\Models\Main\ModuliEnte; |
|
use Illuminate\Database\Eloquent\Model; |
|
use Illuminate\Database\Eloquent\Relations\HasMany; |
|
use Illuminate\Database\Eloquent\Factories\HasFactory; |
|
|
|
class Enti 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_enti"; |
|
|
|
/** |
|
* 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'; |
|
|
|
/** |
|
* Recupera le pec per l'ente istanziatos. |
|
* |
|
* @return void |
|
*/ |
|
public function pec(): HasMany |
|
{ |
|
return $this->hasMany(Pec::class, "codice", "codice_ente"); |
|
} |
|
|
|
/** |
|
* Ottieni tutti i moduli per l'Ente |
|
* |
|
* @return \Illuminate\Database\Eloquent\Relations\HasMany |
|
*/ |
|
public function moduli(): HasMany |
|
{ |
|
return $this->hasMany(ModuliEnte::class, "cod_ente", "codice"); |
|
} |
|
|
|
}
|
|
|