Update Linking With ASO

This commit is contained in:
R
2023-02-17 14:29:50 +07:00
parent 912edcdae7
commit 5c71b556a0
10 changed files with 194 additions and 6 deletions

View File

@@ -14,6 +14,23 @@ class MemberResource extends JsonResource
*/
public function toArray($request)
{
return parent::toArray($request);
// $data = parent::toArray($request);
$currentMemberPlan = $this->memberPlans?->first();
$currentPlan = $currentMemberPlan ? [
'code' => $currentMemberPlan->plan->code ?? null,
'start' => $currentMemberPlan->start,
'end' => $currentMemberPlan->end
] : null;
$data = [
'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' => $currentPlan
];
return $data;
}
}