*/ public function toArray(Request $request): array { return [ 'id' => $this->resource->id, 'name' => $this->resource->name, 'slug' => $this->resource->slug, 'sku' => $this->resource->sku, 'short_description' => $this->resource->short_description, 'description' => $this->resource->description, 'thumbnail_url' => $this->resource->thumbnail_path ?? null, 'price' => $this->resource->price, 'stock_quantity' => $this->resource->stock_quantity, 'active' => $this->resource->active, 'published_at' => $this->resource->published_at, 'category' => CategoryResource::make($this->whenLoaded('category')), 'brand' => BrandResource::make($this->whenLoaded('brand')), ]; } }