27 lines
697 B
PHP
27 lines
697 B
PHP
<?php
|
|
|
|
namespace App\Domains\FiestaFutbolInfantil\Resources;
|
|
|
|
use App\Domains\Catalog\Models\CatalogItem;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
/** @mixin CatalogItem */
|
|
class EntryResource extends JsonResource
|
|
{
|
|
/** @return array<string, mixed> */
|
|
public function toArray(Request $request): array
|
|
{
|
|
return [
|
|
'id' => $this->id,
|
|
'title' => $this->nombre,
|
|
'description' => $this->descripcion,
|
|
'variants' => $this->variants
|
|
->whereNull('replaced_by_variant_id')
|
|
->values()
|
|
->toArray(),
|
|
'price' => $this->precio,
|
|
];
|
|
}
|
|
}
|