31 lines
842 B
PHP
31 lines
842 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<array-key, mixed> $items */
|
|
public function __construct($resource, private readonly array $items)
|
|
{
|
|
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_layout' => $this->group_layout->value,
|
|
'group_order' => $this->group_order,
|
|
'items' => $this->items,
|
|
];
|
|
}
|
|
}
|