MiknasTrading/app/Models/Supplier.php
Ghassan Yusuf 92a2eb120f feat: add whatsapp_number field to suppliers, customers, users
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-19 13:02:06 +03:00

43 lines
987 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', 'whatsapp_number',
'address', 'website',
'tax_number', 'credit_terms', 'credit_days',
'is_active', 'remarks',
];
protected $casts = ['is_active' => 'boolean'];
public function routeNotificationFor(string $channel, mixed $notification = null): ?string
{
return $this->whatsapp_number;
}
public function purchaseOrders()
{
return $this->hasMany(PurchaseOrder::class);
}
public function invoices()
{
return $this->hasMany(SupplierInvoice::class);
}
public function payments()
{
return $this->hasMany(SupplierPayment::class);
}
}