78 lines
3.9 KiB
PHP
78 lines
3.9 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
use App\Models\Product;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
use App\Models\ProductImage;
|
|
class InfrastructureFundResource extends JsonResource
|
|
{
|
|
/**
|
|
* Transform the resource into an array.
|
|
*
|
|
* @param \Illuminate\Http\Request $request
|
|
* @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
|
|
*/
|
|
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) == null ? null : Product::where('id',$this->products_id)->value('presentation'),
|
|
'fact_sheet' => Product::find($this->products_id) == null ? null : Product::where('id',$this->products_id)->value('fact_sheet'),
|
|
'fund_name' => $this->fund_name ?? '',
|
|
'slug' => $this->slug ?? '',
|
|
'isin_code' => $this->isin_code ?? '',
|
|
'registration_number' => $this->registration_number,
|
|
'fund_category' => $this->fund_category ?? '',
|
|
'fund_structure' => $this->fund_structure ?? '',
|
|
'fund_strategy' => $this->fund_strategy ?? '',
|
|
'fund_domicile' => $this->fund_domicile ?? '',
|
|
'fund_manager_name' => $this->fund_manager_name ?? '',
|
|
'website_of_the_fund' => $this->website_of_the_fund ?? '',
|
|
'fund_manager_experience' => $this->fund_manager_experience ?? '',
|
|
'sponsor' => $this->sponsor ?? '',
|
|
'manager' => $this->manager ?? '',
|
|
'trustee' => $this->trustee ?? '',
|
|
'auditor' => $this->auditor ?? '',
|
|
'valuer_tax_advisor' => $this->valuer_tax_advisor ?? '',
|
|
'credit_rating' => $this->credit_rating ?? '',
|
|
'open_date' => $this->open_date ?? '',
|
|
'first_close_date' => $this->first_close_date ?? '',
|
|
'final_close_date' => $this->final_close_date ?? '',
|
|
'tenure_from_final_close' => $this->tenure_from_final_date ?? '',
|
|
'commitment_period' => $this->commitment_period ?? '',
|
|
'native_currency' => $this->native_currency ?? '',
|
|
'target_corpus' => $this->target_corpus ?? '',
|
|
'investment_manager_contribution' => $this->investment_manager_contribution ?? '',
|
|
'minimum_capital_commitment' => $this->minimum_capital_commitment ?? '',
|
|
'intial_drawdown' => $this->intial_drawdown ?? '',
|
|
'accepting_overseas_investment' => $this->accepting_overseas_investment ?? '',
|
|
'target_irr' => $this->target_irr ?? '',
|
|
'management_fees_and_carry' => $this->management_fees_and_carry ?? '',
|
|
'hurdle_rate' => $this->hurdle_rate ?? '',
|
|
'other_expenses' => $this->other_expenses ?? '',
|
|
'focused_sectors_industries' => $this->focused_sectors_industries ?? '',
|
|
'regions_covered' => $this->regions_covered ?? '',
|
|
'company' => $this->companies,
|
|
'minimum_investment' => $this->minimum_investment,
|
|
'description' => Product::find($this->products_id) == null ? null : Product::where('id',$this->products_id)->value('description'),
|
|
'focused_funds' => $this->focused_funds,
|
|
'return_on_investment_irr_dpi_rvpi_tvpi' => $this->return_on_investment_irr_dpi_rvpi_tvpi,
|
|
'valuation_per_security_nav' => $this->valuation_per_security_nav,
|
|
'trading_strategy_used' => $this->trading_strategy_used,
|
|
'involved_in_short_selling' => $this->involved_in_short_selling,
|
|
];
|
|
}
|
|
}
|