Files
freeu-project/app/Http/Resources/GlobalEquityStockRealEstateResource.php
Ritikesh yadav c661166e1d first commit
2024-03-28 14:52:40 +05:30

44 lines
1.5 KiB
PHP

<?php
namespace App\Http\Resources;
use App\Models\Product;
use Illuminate\Http\Resources\Json\JsonResource;
class GlobalEquityStockRealEstateResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
* @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
*/
public function toArray($request)
{
return [
'id' => $this->id,
'products_id' => $this->products_id,
'presentation' => Product::find($this->products_id)->value('presentation'),
'fact_sheet' => Product::find($this->products_id)->value('fact_sheet'),
'name' => $this->name,
'type' => $this->type,
'slug' => $this->slug,
'ticker' => $this->ticker,
'exchange' => $this->exchange,
'about' => $this->about,
'industry' => $this->industry,
'market_cap' => $this->market_cap,
'pe_ratio' => $this->pe_ratio,
'dividend_yield' => $this->dividend_yield,
'beta' => $this->beta,
'provider' => $this->provider,
'category' => $this->category,
'expense_ratio' => $this->expense_ratio,
'month1_return' => $this->month1_return,
'month6_return' => $this->month6_return,
'year1_return' => $this->year1_return,
'year3_return' => $this->year3_return,
];
}
}