34 lines
759 B
PHP
34 lines
759 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class SupplierPayment extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $fillable = ['supplier_invoice_id', 'supplier_id', 'payment_date', 'amount', 'payment_method', 'reference_number', 'notes', 'created_by'];
|
|
|
|
protected $casts = [
|
|
'payment_date' => 'date',
|
|
'amount' => 'decimal:2',
|
|
];
|
|
|
|
public function supplierInvoice()
|
|
{
|
|
return $this->belongsTo(SupplierInvoice::class);
|
|
}
|
|
|
|
public function supplier()
|
|
{
|
|
return $this->belongsTo(Supplier::class);
|
|
}
|
|
|
|
public function createdBy()
|
|
{
|
|
return $this->belongsTo(\App\Models\User::class, 'created_by');
|
|
}
|
|
}
|