FleetCart/Modules/Product/Transformers/ProductAttributeResource.php
2023-12-03 14:07:47 +00:00

25 lines
506 B
PHP

<?php
namespace Modules\Product\Transformers;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
class ProductAttributeResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param Request
*
* @return array
*/
public function toArray($request)
{
return [
'attribute_id' => $this->attribute_id,
'values' => $this->values->pluck('id'),
];
}
}