Edit File: ProductResource.php
<?php namespace App\Http\Resources\Api\User; use Illuminate\Http\Resources\Json\JsonResource; class ProductResource extends JsonResource { public function toArray($request) { return [ 'id' => $this?->id, 'name' => $this?->name, 'has_price' => $this?->has_price, 'has_price_text' => $this?->has_price_text, 'has_product_classifications' => (bool)($this?->product_classifications_count), 'description' => $this?->description, 'price' => !is_null($this->price) ? number_format($this->price, 2) : null, 'price_after_discount' => !is_null($this->price_after_discount) ? number_format($this->price_after_discount, 2) : null, 'image' => $this?->productImages()?->first()?->image ?? null, ]; } }
Back to File Manager