Edit File: ProductGroupResource.php
<?php namespace App\Http\Resources; use Illuminate\Http\Resources\Json\JsonResource; class ProductGroupResource extends JsonResource { /** * Transform the resource into an array. * * @param \Illuminate\Http\Request $request * @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable */ public function toArray($request) { $properties = $this->ProperitiesData ?? ''; if(is_int($this->price()) == false) { $price = (string)$this->price; }else{ $price = (string)$this->price(); } if($this->discount_price == null) { $discount_price= null; }else{ $discount_price = (string)number_format($this->discount_price , 1, '.', ); } return [ 'id' =>$this->id, 'price' =>$price??'', 'in_stock_sku' => $this->in_stock_sku??'', 'in_stock_qty' => '', 'in_stock_type'=>$this->in_stock_type??'', 'price_after_discount' => $discount_price, 'discount_from' =>$this->from??'', 'discount_to' =>$this->to??'', 'propreties' =>$properties??'', 'display_price' => $this->display_price()??0, ]; } }
Back to File Manager