44 lines
1.6 KiB
PHP
44 lines
1.6 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) ? 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,
|
|
'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,
|
|
];
|
|
}
|
|
}
|