diff --git a/app/Http/Resources/GlobalFundResource.php b/app/Http/Resources/GlobalFundResource.php index 9bd0d22..529a295 100644 --- a/app/Http/Resources/GlobalFundResource.php +++ b/app/Http/Resources/GlobalFundResource.php @@ -16,9 +16,19 @@ class GlobalFundResource extends JsonResource */ public function toArray($request) { + $images = ProductImage::where('product_xid', $this->products_id)->get(); + $imagePaths = []; + if (!empty($images)) { + foreach ($images as $imageItem) { + $path = asset('public/' . $imageItem['images']); + $imagePaths[] = $path; + } + + } return [ 'id' => $this->id, 'products_id' => $this->products_id, + 'product_images' => $imagePaths, 'presentation' => Product::find($this->products_id) ? Product::find($this->products_id)->value('presentation') : null, 'fact_sheet' => Product::find($this->products_id) ? Product::find($this->products_id)->value('fact_sheet') : null, 'slug' => $this->slug, @@ -40,7 +50,7 @@ class GlobalFundResource extends JsonResource 'year1_return' => $this->year1_return, 'year3_return' => $this->year3_return, 'returns' => $this->returns, - 'product_images' => ProductImage::where('product_xid',$this->products_id)->get(), + // 'product_images' => ProductImage::where('product_xid',$this->products_id)->get(), ]; } diff --git a/app/Imports/AlternativeInvestmentFundImport.php b/app/Imports/AlternativeInvestmentFundImport.php index 7af15ad..9132846 100644 --- a/app/Imports/AlternativeInvestmentFundImport.php +++ b/app/Imports/AlternativeInvestmentFundImport.php @@ -66,7 +66,7 @@ class AlternativeInvestmentFundImport implements ToCollection, WithHeadingRow AlternativeInvestmentFund::create([ 'products_id' => $product->id, - 'slug' => Str::slug($row['name_of_the_fund']).'-'.$count+1, + 'slug' => $count < 1 ? Str::slug($row['name_of_the_fund']) : Str::slug($row['name_of_the_fund']).'-'.$count+1, 'fund_name' => $row['name_of_the_fund'], 'registration_number' => $row['registration_no'] ?? null, 'fund_category' => $row['fund_category_iiiiii'], diff --git a/public/assets/uploads/product_images/202404151340_1711435445_factsheet.jpg b/public/assets/uploads/product_images/202404151340_1711435445_factsheet.jpg new file mode 100644 index 0000000..e22ed82 Binary files /dev/null and b/public/assets/uploads/product_images/202404151340_1711435445_factsheet.jpg differ diff --git a/public/assets/uploads/product_images/202404151340_Woka FM_MASILA_player with characters.png b/public/assets/uploads/product_images/202404151340_Woka FM_MASILA_player with characters.png new file mode 100644 index 0000000..2c2ce6c Binary files /dev/null and b/public/assets/uploads/product_images/202404151340_Woka FM_MASILA_player with characters.png differ diff --git a/public/assets/uploads/product_images/202404151340_Woka FM_MASILA_player with characters_01.png b/public/assets/uploads/product_images/202404151340_Woka FM_MASILA_player with characters_01.png new file mode 100644 index 0000000..4556200 Binary files /dev/null and b/public/assets/uploads/product_images/202404151340_Woka FM_MASILA_player with characters_01.png differ