54 lines
1.3 KiB
PHP
54 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class StabileAmministratoreTransfer extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $table = 'stabile_amministratore_transfers';
|
|
|
|
protected $fillable = [
|
|
'stabile_id',
|
|
'from_amministratore_id',
|
|
'to_amministratore_id',
|
|
'changed_by_user_id',
|
|
'changed_by_name',
|
|
'source',
|
|
'reason',
|
|
'also_rubrica',
|
|
'ip_address',
|
|
'meta',
|
|
];
|
|
|
|
protected $casts = [
|
|
'also_rubrica' => 'boolean',
|
|
'meta' => 'array',
|
|
'created_at' => 'datetime',
|
|
'updated_at' => 'datetime',
|
|
];
|
|
|
|
public function stabile(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Stabile::class, 'stabile_id', 'id');
|
|
}
|
|
|
|
public function fromAmministratore(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Amministratore::class, 'from_amministratore_id', 'id');
|
|
}
|
|
|
|
public function toAmministratore(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Amministratore::class, 'to_amministratore_id', 'id');
|
|
}
|
|
|
|
public function changedByUser(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class, 'changed_by_user_id', 'id');
|
|
}
|
|
} |