feat(entry): implement EntryController, EntryService, and EntryResource for managing entries

This commit is contained in:
2026-08-07 12:34:38 -03:00
parent ed4502425a
commit 6a6d3690cc
9 changed files with 531 additions and 27 deletions

View File

@@ -0,0 +1,26 @@
<?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
{
$variant = $this->variants->sole();
return [
'id' => $this->id,
'title' => $this->nombre,
'description' => $this->descripcion,
'event_date_ids' => $variant->selectedEventDates()->pluck('id')->values(),
'stock' => $variant->inventory->real_stock,
'price' => $this->precio,
];
}
}