[WIP] Update
This commit is contained in:
@@ -17,8 +17,12 @@ class ClaimRequest extends Model
|
||||
protected static $code_prefix = 'CRQ';
|
||||
|
||||
public $fillable = [
|
||||
'uuid',
|
||||
'submission_date',
|
||||
'member_id',
|
||||
'payment_type',
|
||||
'service_code',
|
||||
'policy_id',
|
||||
'status',
|
||||
'claim_id'
|
||||
];
|
||||
@@ -35,13 +39,19 @@ class ClaimRequest extends Model
|
||||
public static $status = [
|
||||
'draft' => 'Draft',
|
||||
'requested' => 'Requested',
|
||||
'received' => 'Received',
|
||||
'approved' => 'Approved',
|
||||
'postpone' => 'Postpone',
|
||||
'paid' => 'Paid',
|
||||
'declined' => 'Declined'
|
||||
];
|
||||
|
||||
public static $payment_types = [
|
||||
'cashless' => 'Cashless',
|
||||
'reimbursement' => 'Reimbursement'
|
||||
];
|
||||
|
||||
public $appends = [
|
||||
'payment_type_name'
|
||||
];
|
||||
|
||||
protected static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
@@ -116,6 +126,11 @@ class ClaimRequest extends Model
|
||||
return (string) self::$code_prefix .'-'. str_pad($next_number, 5, 0, STR_PAD_LEFT);
|
||||
}
|
||||
|
||||
public function claim()
|
||||
{
|
||||
return $this->belongsTo(Claim::class, 'claim_id');
|
||||
}
|
||||
|
||||
public function claims()
|
||||
{
|
||||
return $this->hasMany(Claim::class, 'claim_request_id');
|
||||
@@ -140,4 +155,19 @@ class ClaimRequest extends Model
|
||||
{
|
||||
return $this->belongsTo(Member::class, 'member_id', 'id');
|
||||
}
|
||||
|
||||
public function service()
|
||||
{
|
||||
return $this->belongsTo(Service::class, 'service_code', 'code');
|
||||
}
|
||||
|
||||
public function getPaymentTypeNameAttribute()
|
||||
{
|
||||
return self::$payment_types[$this->payment_type] ?? $this->payment_type;
|
||||
}
|
||||
|
||||
public function getStatusAttribute($value)
|
||||
{
|
||||
return self::$payment_types[$value] ?? $value;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user