sarga/packages/Sarga/API/Http/Resources/Catalog/Menu.php

29 lines
661 B
PHP
Raw Normal View History

2022-09-25 15:56:43 +00:00
<?php
namespace Sarga\API\Http\Resources\Catalog;
use Illuminate\Http\Resources\Json\JsonResource;
2022-09-27 11:53:08 +00:00
2022-09-25 15:56:43 +00:00
class Menu extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request
* @return array
*/
public function toArray($request): array
{
return [
'id' => $this->id,
'name' => $this->name,
2022-09-25 16:06:53 +00:00
'filter' => $this->filter,
2022-09-25 15:56:43 +00:00
'description' => $this->description,
'categories' => Category::collection($this->categories),
2022-09-27 11:53:08 +00:00
'brands' => Brand::collection($this->brands)
2022-09-25 15:56:43 +00:00
];
}
}