app/Http/Resources/SubscriptionResource.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,
            "plan_start_date" => $this->start_date,
            "plan_end_date" => $this->end_date,
            "status" => $this->status,
            'plan' => new PlanResource($this->whenLoaded('plan'))
        ];
    }
public function toArray ( $ request ) { return [ " id " => $ this -> id , " plan_start_date " => $ this -> start_date , " plan_end_date " => $ this -> end_date , " status " => $ this -> status , 'plan' => new PlanResource ( $ this -> whenLoaded ( 'plan' ) ) ] ; }
Transform the resource into an array.
Transform the resource into an array .