2024-03-28 14:52:40 +05:30
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
|
|
|
|
|
|
use App\Models\Product;
|
2024-04-12 15:07:34 +05:30
|
|
|
|
|
|
|
|
use App\Models\ProductImage;
|
2024-03-28 14:52:40 +05:30
|
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
|
|
|
|
|
|
class InvoiceDiscountingResource extends JsonResource
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* Transform the resource into an array.
|
|
|
|
|
*
|
|
|
|
|
* @param \Illuminate\Http\Request $request
|
|
|
|
|
* @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
|
|
|
|
|
*/
|
|
|
|
|
public function toArray($request)
|
|
|
|
|
{
|
2024-04-12 15:07:34 +05:30
|
|
|
$images = ProductImage::where('product_xid', $this->products_id)->get();
|
|
|
|
|
$imagePaths = [];
|
|
|
|
|
if (!empty($images)) {
|
|
|
|
|
foreach ($images as $imageItem) {
|
|
|
|
|
$path = asset('public/' . $imageItem['images']);
|
|
|
|
|
$imagePaths[] = $path;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
2024-03-28 14:52:40 +05:30
|
|
|
return [
|
|
|
|
|
'id' => $this->id,
|
|
|
|
|
'products_id' => $this->products_id,
|
2024-04-12 15:07:34 +05:30
|
|
|
'product_images' => $imagePaths,
|
2024-04-30 11:02:34 +05:30
|
|
|
'presentation' => Product::where('id',$this->products_id)->value('presentation'),
|
|
|
|
|
'fact_sheet' => Product::where('id',$this->products_id)->value('fact_sheet'),
|
2024-03-28 14:52:40 +05:30
|
|
|
'company_name' => $this->company_name,
|
|
|
|
|
'slug' => $this->slug,
|
|
|
|
|
'sector' => $this->sector,
|
|
|
|
|
'about_company' => $this->about_company,
|
|
|
|
|
'key_performance_metrics' => $this->key_performance_metrics,
|
|
|
|
|
'minimum_investment' => $this->minimum_investment,
|
|
|
|
|
'total_deal_size' => $this->total_deal_size,
|
|
|
|
|
'tenure' => $this->tenure,
|
|
|
|
|
'pre_tax_irr' => $this->pre_tax_irr,
|
|
|
|
|
'coupon_rate' => $this->coupon_rate,
|
|
|
|
|
'vendor' => $this->vendor,
|
|
|
|
|
'recourse_on' => $this->recourse_on,
|
|
|
|
|
'settlement_date' => $this->settlement_date,
|
|
|
|
|
'payout_frequency' => $this->payout_frequency,
|
|
|
|
|
'payment_obligor' => $this->payment_obligor,
|
|
|
|
|
'security_structure' => $this->security_structure,
|
|
|
|
|
'minimum_investment_in_int' => $this->minimum_investment_in_int,
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
}
|