Update Linking With ASO
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user