manual linking apps
This commit is contained in:
@@ -3,8 +3,10 @@
|
||||
namespace App\Http\Resources\OLDLMS;
|
||||
|
||||
use App\Services\ClaimService;
|
||||
use App\Models\Corporate;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
|
||||
class MemberResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
@@ -21,28 +23,17 @@ class MemberResource extends JsonResource
|
||||
$limitTelecon = $this->totalUsage >= 6 ? null : $limitTelecon;
|
||||
|
||||
$data = [
|
||||
'id' => $this->id,
|
||||
'member_name' => $this->full_name,
|
||||
'member_id' => $this->member_id,
|
||||
'birth_date' => $this->birth_date,
|
||||
'email' => $this->email,
|
||||
'phone' => $this->person->phone ?? null,
|
||||
'full_name' => $this->full_name,
|
||||
'nric' => $this->nric,
|
||||
'plan' => $currentMemberPlan ? [
|
||||
'code' => $currentMemberPlan->plan->code ?? null,
|
||||
'start' => $currentMemberPlan->start,
|
||||
'end' => $currentMemberPlan->end,
|
||||
'limit' => $this->currentPlan->limit_rules,
|
||||
'limit_consultation' => 6
|
||||
] : null,
|
||||
'policy_code' => $this->currentPolicy?->code ?? null,
|
||||
'corporate' => [
|
||||
'code' => $this->currentPolicy?->corporate->code ?? null,
|
||||
'name' => $this->currentPolicy?->corporate->name,
|
||||
'welcome_message' => $this->currentPolicy?->corporate->welcome_message,
|
||||
'help_text' => $this->currentPolicy?->corporate?->help_text,
|
||||
'avatar_url' => $this->currentpolicy?->corporate?->avatar_url
|
||||
],
|
||||
'limit_usage' => $this->totalUsage ?? null
|
||||
'policy_holder' => $this->currentPolicy->corporate->name,
|
||||
'policy_number' => $this->currentPolicy->code ?? null,
|
||||
'date_of_birth' => $this->birth_date,
|
||||
'gender' => $this->gender,
|
||||
'start_date' => $this->members_effective_date,
|
||||
'corporate_logo' => $this->full_name,
|
||||
'valid_until' => $this->members_expire_date,
|
||||
|
||||
];
|
||||
return $data;
|
||||
}
|
||||
|
||||
@@ -246,5 +246,14 @@ class Member extends Model
|
||||
get: fn () => $this->person->gender ?? null
|
||||
);
|
||||
}
|
||||
|
||||
protected function corporateLogo(): Attribute
|
||||
{
|
||||
$avatar = File::where(['type' => 'avatar', 'fileable_id' => $this->currentPolicy->corporate->id])->orderBy('id', 'desc')->get()->first();
|
||||
$path = $_ENV['LMS_APP_STORAGE'] . $avatar->path;
|
||||
return Attribute::make(
|
||||
get: fn () => $avatar ? $path : null
|
||||
);
|
||||
}
|
||||
/* -------------------------------------------------------------------------- */
|
||||
}
|
||||
|
||||
@@ -26,5 +26,7 @@ class UserInsurance extends Model
|
||||
'dTanggalLahir',
|
||||
'nNoKTP',
|
||||
'sNoPolis',
|
||||
'nIDInsurance',
|
||||
'sLayanan',
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user