[WIP] Update Claim

This commit is contained in:
R
2023-03-06 02:10:08 +07:00
parent 91ba718a50
commit 35119ee8ec
18 changed files with 1066 additions and 18 deletions

View File

@@ -44,6 +44,11 @@ class Benefit extends Model
// return $this->belongsTo(Benefit::class, 'benefit_code', 'code');
// }
public function claimItem()
{
return $this->morphMany(ClaimItem::class, 'claim_itemable');
}
public function plans()
{
return $this->belongsToMany(Plan::class, 'corporate_benefits', 'benefit_id', 'id')

View File

@@ -139,6 +139,11 @@ class Claim extends Model
return $this->morphMany(File::class, 'fileable');
}
public function items()
{
return $this->hasMany(ClaimItem::class, 'claim_id');
}
public function member()
{
return $this->belongsTo(Member::class, 'member_id');

View File

@@ -10,4 +10,12 @@ class ClaimDiagnosis extends Model
use HasFactory;
protected $table = 'claim_diagnosis';
public $fillable = [
'claim_id',
'type',
'diagnosis_id',
'note',
'description',
];
}

32
app/Models/ClaimItem.php Normal file
View File

@@ -0,0 +1,32 @@
<?php
namespace App\Models;
use App\Traits\Blameable;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class ClaimItem extends Model
{
use HasFactory, SoftDeletes, Blameable;
protected $fillable = [
'claim_id',
'order',
'currency',
'nominal_ditagihkan',
'nominal_dicover',
'nominal_total',
];
public function claim()
{
return $this->belongsTo(Claim::class, 'claim_id');
}
public function claim_itemable()
{
return $this->morphTo();
}
}

View File

@@ -28,6 +28,8 @@ class File extends Model
'created_by',
'updated_by',
'deleted_by',
'fileable_type',
'fileable_id'
];
public $appends = [