funds single data updated

This commit is contained in:
Hritikkk9
2024-04-16 18:40:56 +05:30
parent cdcd1cc91b
commit c098c66bd9
5 changed files with 12 additions and 2 deletions

View File

@@ -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(),
];
}

View File

@@ -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'],

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 518 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 590 KiB