backoffice first commit
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
class Cliente extends Model
|
||||
{
|
||||
protected $table = 'clienti';
|
||||
|
||||
protected $fillable = [
|
||||
'nome', 'cognome', 'ragione_sociale', 'email', 'telefono',
|
||||
'indirizzo', 'cap', 'citta', 'provincia', 'note',
|
||||
];
|
||||
|
||||
public function preventivi(): HasMany
|
||||
{
|
||||
return $this->hasMany(Preventivo::class);
|
||||
}
|
||||
|
||||
public function getNominativoAttribute(): string
|
||||
{
|
||||
if ($this->ragione_sociale) {
|
||||
return $this->ragione_sociale;
|
||||
}
|
||||
|
||||
return trim("{$this->nome} {$this->cognome}");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user