53 lines
1.1 KiB
PHP
53 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class Payment extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $fillable = [
|
|
'installment_application_id',
|
|
'installment_schedule_id',
|
|
'user_id',
|
|
'transaction_no',
|
|
'receipt_no',
|
|
'biller_code',
|
|
'ref_1',
|
|
'ref_2',
|
|
'amount',
|
|
'status',
|
|
'payload',
|
|
'paid_at',
|
|
'remarks',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'amount' => 'decimal:2',
|
|
'payload' => 'array',
|
|
'paid_at' => 'datetime',
|
|
];
|
|
}
|
|
|
|
public function application(): BelongsTo
|
|
{
|
|
return $this->belongsTo(InstallmentApplication::class, 'installment_application_id');
|
|
}
|
|
|
|
public function schedule(): BelongsTo
|
|
{
|
|
return $this->belongsTo(InstallmentSchedule::class, 'installment_schedule_id');
|
|
}
|
|
|
|
public function user(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class);
|
|
}
|
|
}
|