25 lines
506 B
PHP
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'),
|
|
];
|
|
}
|
|
}
|