58 lines
1.3 KiB
PHP
58 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 FornitoreCliente extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $table = 'fornitore_clienti';
|
|
|
|
protected $fillable = [
|
|
'amministratore_id',
|
|
'fornitore_id',
|
|
'rubrica_id',
|
|
'legacy_cliente_id',
|
|
'display_name',
|
|
'phone',
|
|
'phone_alt',
|
|
'email',
|
|
'indirizzo',
|
|
'cap',
|
|
'citta',
|
|
'provincia',
|
|
'partita_iva',
|
|
'codice_fiscale',
|
|
'note',
|
|
'source',
|
|
'imported_from_path',
|
|
'imported_at',
|
|
'metadata',
|
|
];
|
|
|
|
protected $casts = [
|
|
'imported_at' => 'datetime',
|
|
'metadata' => 'array',
|
|
'created_at' => 'datetime',
|
|
'updated_at' => 'datetime',
|
|
];
|
|
|
|
public function amministratore(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Amministratore::class, 'amministratore_id');
|
|
}
|
|
|
|
public function fornitore(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Fornitore::class, 'fornitore_id');
|
|
}
|
|
|
|
public function rubrica(): BelongsTo
|
|
{
|
|
return $this->belongsTo(RubricaUniversale::class, 'rubrica_id');
|
|
}
|
|
} |