30 lines
793 B
PHP
30 lines
793 B
PHP
<?php
|
|
|
|
namespace App\Domains\Catalog\Resources;
|
|
|
|
use App\Domains\Catalog\Models\FeaturedGroup;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
/** @mixin FeaturedGroup */
|
|
class CatalogFeaturedGroupResource extends JsonResource
|
|
{
|
|
/** @param array<string, mixed> $itemsPage */
|
|
public function __construct($resource, private readonly array $itemsPage)
|
|
{
|
|
parent::__construct($resource);
|
|
}
|
|
|
|
/** @return array<string, mixed> */
|
|
public function toArray(Request $request): array
|
|
{
|
|
return [
|
|
'id' => $this->id,
|
|
'title' => $this->group_name,
|
|
'layout' => $this->product_layout->value,
|
|
'group_order' => $this->group_order,
|
|
'items' => $this->itemsPage,
|
|
];
|
|
}
|
|
}
|