38 lines
821 B
PHP
38 lines
821 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Supplier extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $fillable = [
|
|
'supplier_code', 'name', 'category',
|
|
'contact_person', 'email', 'secondary_email',
|
|
'phone', 'phone2', 'whatsapp',
|
|
'address', 'website',
|
|
'tax_number', 'credit_terms', 'credit_days',
|
|
'is_active', 'remarks',
|
|
];
|
|
|
|
protected $casts = ['is_active' => 'boolean'];
|
|
|
|
public function purchaseOrders()
|
|
{
|
|
return $this->hasMany(PurchaseOrder::class);
|
|
}
|
|
|
|
public function invoices()
|
|
{
|
|
return $this->hasMany(SupplierInvoice::class);
|
|
}
|
|
|
|
public function payments()
|
|
{
|
|
return $this->hasMany(SupplierPayment::class);
|
|
}
|
|
}
|