products_id)->get(); $imagePaths = []; if (!empty($images)) { foreach ($images as $imageItem) { $path = asset('public/' . $imageItem['images']); $imagePaths[] = $path; } } // return parent::toArray($request); return [ 'id' => $this->id, 'products_id' => $this->products_id, 'product_images' => $imagePaths, 'presentation' => Product::where('id',$this->products_id)->value('presentation'), 'fact_sheet' => Product::where('id',$this->products_id)->value('fact_sheet'), 'slug' => $this->slug, 'security_name' => $this->security_name, 'security_type' => $this->security_type, 'isin' => $this->isin, 'issuer_company' => $this->issuer_company, 'issue_size' => $this->issue_size, 'issue_type' => $this->issue_type, 'listing_details' => $this->listing_details, 'rating_category' => $this->rating_category, 'minimum_investment' => $this->minimum_investment, 'coupon_rate' => $this->coupon_rate, 'yield_to_maturity' => $this->yield_to_maturity, 'interest_payment_frequency' => $this->interest_payment_frequency, 'allotment_date' => $this->allotment_date, 'maturity_date' => $this->maturity_date, 'minimum_investment_in_int' => $this->minimum_investment_in_int, ]; } }