app/Http/Resources/MemberListResource.php
/**
     * Transform the resource into an array.
     *
     * @param \Illuminate\Http\Request $request
     * @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
     */
Transform the resource into an array.
Transform the resource into an array .
public function toArray($request)
    {
        return [
            "id" => $this->id,
            "name" => $this->name,
            "gender" => $this->gender,
            "phone_number" => $this->phone,
            "email" => $this->email,
            'account' => new AccountResource($this->whenLoaded('account'))
        ];
    }
public function toArray ( $ request ) { return [ " id " => $ this -> id , " name " => $ this -> name , " gender " => $ this -> gender , " phone_number " => $ this -> phone , " email " => $ this -> email , 'account' => new AccountResource ( $ this -> whenLoaded ( 'account' ) ) ] ; }
Transform the resource into an array.
Transform the resource into an array .