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.
78 righe
1.6 KiB
78 righe
1.6 KiB
<?php |
|
|
|
namespace App\Models\Main; |
|
|
|
use App\Models\Main\Pec; |
|
use App\Models\Main\Comunicazioni; |
|
use Illuminate\Database\Eloquent\Model; |
|
use Illuminate\Database\Eloquent\Relations\HasMany; |
|
use Illuminate\Database\Eloquent\Relations\BelongsTo; |
|
use Illuminate\Database\Eloquent\Factories\HasFactory; |
|
|
|
class Messaggi extends Model |
|
{ |
|
use HasFactory; |
|
|
|
/** |
|
* The connection name for the model. |
|
* |
|
* @var string|null |
|
*/ |
|
protected $connection = "mysql"; |
|
|
|
/** |
|
* Determine if the model uses timestamps. |
|
* |
|
* @var bool |
|
*/ |
|
public $timestamps = false; |
|
|
|
/** |
|
* The table associated with the model. |
|
* |
|
* @var string |
|
*/ |
|
protected $table = "r_comunicazioni_utenti"; |
|
|
|
/** |
|
* The primary key for the model. |
|
* |
|
* @var string |
|
*/ |
|
protected $primaryKey = 'codice'; |
|
|
|
/** |
|
* The name of the "created at" column. |
|
* |
|
* @var string|null |
|
* |
|
* const UPDATED_AT = 'timestamp_creazione'; |
|
*/ |
|
|
|
/** |
|
* The name of the "updated at" column. |
|
* |
|
* @var string|null |
|
*/ |
|
const CREATED_AT = 'timestamp'; |
|
|
|
/** |
|
* Ottieni la comunicazione che relativa a questo record |
|
* |
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
|
*/ |
|
public function comunicazione(): BelongsTo |
|
{ |
|
return $this->belongsTo(Comunicazioni::class, 'codice', 'codice_comunicazione'); |
|
} |
|
|
|
/** |
|
* Ottieni la pec relativa a questo record |
|
* |
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
|
*/ |
|
public function pec(): BelongsTo |
|
{ |
|
return $this->belongsTo(Pec::class, 'codice_pec', 'codice'); |
|
} |
|
}
|
|
|