1
0
Fork 0

initial commit

This commit is contained in:
Henrik Hautakoski 2026-04-07 23:16:12 +02:00
commit ae93c7e1a6
233 changed files with 20282 additions and 0 deletions

View file

@ -0,0 +1,35 @@
<?php
namespace App\Http\Resources;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
/**
* @property \App\Models\Product $resource
*/
class ProductResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @return array<string, mixed>
*/
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,
'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')),
];
}
}