Files
project/app/Models/Supplier.php
2025-02-13 17:13:20 +01:00

57 lines
1.1 KiB
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\SoftDeletes;
class Supplier extends Model
{
use SoftDeletes;
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = [
'name',
'registration_name',
'email',
'address',
'city',
'zip',
'country_code',
'tax_fc',
'tax_vat',
'contact_name',
'contact_phone',
'contact_email',
];
/**
* The attributes that are appended with attribute getters.
*
* @var string[]
*/
protected $appends = [
'created',
];
/**
* Get the issue_date attribute in local time format.
*/
public function getCreatedAttribute(): string
{
return $this->created_at->format('d.m.Y');
}
/**
* Get the supplier's incoming invoices.
*/
public function invoices(): HasMany
{
return $this->hasMany(Incoming::class);
}
}