sarga/packages/Webkul/API/Http/Resources/Catalog/Attribute.php

28 lines
742 B
PHP
Raw Normal View History

2019-03-13 11:17:52 +00:00
<?php
namespace Webkul\API\Http\Resources\Catalog;
use Illuminate\Http\Resources\Json\JsonResource;
class Attribute extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request
* @return array
*/
2021-10-06 12:26:08 +00:00
public function toArray($request): array
2019-03-13 11:17:52 +00:00
{
return [
2020-02-19 11:24:04 +00:00
'id' => $this->id,
'code' => $this->code,
'type' => $this->type,
'name' => $this->name,
2019-03-13 11:17:52 +00:00
'swatch_type' => $this->swatch_type,
2020-02-19 11:24:04 +00:00
'options' => AttributeOption::collection($this->options),
'created_at' => $this->created_at,
'updated_at' => $this->updated_at,
2019-03-13 11:17:52 +00:00
];
}
}