Files
freeu-project/app/Http/Resources/HedgeFundResource.php
2024-06-18 13:09:36 +05:30

83 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 HedgeFundResource 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) ? Product::where('id',$this->products_id)->value('presentation') : null,
'fact_sheet' => Product::find($this->products_id) ? Product::where('id',$this->products_id)->value('fact_sheet') : null,
'fund_name' => $this->fund_name,
'slug' => $this->slug,
'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_date' => $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,
'target_irr' => $this->target_irr,
'accepting_overseas_investment' => $this->accepting_overseas_investment,
'return_on_investment' => $this->return_on_investment,
'valuation_per_sector' => $this->valuation_per_sector,
'management_fees_and_carry' => $this->management_fees_and_carry,
'hurdle_rate' => $this->hurdle_rate,
'other_expenses' => $this->other_expenses,
'focused_funds' => $this->focused_funds,
'trading_strategy' => $this->trading_strategy,
'involved_in_short_selling' => $this->involved_in_short_selling,
'minimum_investment' => $this->minimum_investment,
'company' => $this->companies,
'regions_covered' => $this->regions_covered,
'isin_code'=>$this->isin_code,
'focused_real_estate_sectors'=>$this->focused_real_estate_sectors,
'rera_complied_property' =>$this->rera_complied_property,
'description' => Product::find($this->products_id) == null ? null : Product::where('id',$this->products_id)->value('description'),
'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,
];
}
}