40 lines
832 B
PHP
40 lines
832 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class Payment extends Model
|
|
{
|
|
use HasFactory, SoftDeletes;
|
|
|
|
protected $fillable = [
|
|
'payment_number',
|
|
'invoice_id',
|
|
'payment_date',
|
|
'amount',
|
|
'payment_method',
|
|
'reference_number',
|
|
'notes',
|
|
'received_by',
|
|
];
|
|
|
|
protected $casts = [
|
|
'payment_date' => 'date',
|
|
'amount' => 'decimal:2',
|
|
];
|
|
|
|
public function invoice(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Invoice::class);
|
|
}
|
|
|
|
public function receivedBy(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class, 'received_by');
|
|
}
|
|
}
|