Files
crewli/api/app/Http/Resources/Api/V1/EventResource.php
bert.hausmans c776331cf8 feat: festival/event model frontend + topbar activeren
- Events lijst: card grid met festival/serie chips
- Festival detail: programmaonderdelen grid
- CreateSubEventDialog voor sub-events binnen festival
- EventTabsNav: breadcrumb terug naar festival
- Sessie A: festival-bewuste EventResource + children endpoint
- Topbar: zoekbalk, theme switcher, shortcuts, notificaties
- Schema v1.7 + BACKLOG.md toegevoegd
- 121 tests groen
2026-04-08 10:06:47 +02:00

41 lines
1.6 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Http\Resources\Api\V1;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
final class EventResource extends JsonResource
{
public function toArray(Request $request): array
{
return [
'id' => $this->id,
'organisation_id' => $this->organisation_id,
'parent_event_id' => $this->parent_event_id,
'name' => $this->name,
'slug' => $this->slug,
'start_date' => $this->start_date->toDateString(),
'end_date' => $this->end_date->toDateString(),
'timezone' => $this->timezone,
'status' => $this->status,
'event_type' => $this->event_type,
'event_type_label' => $this->event_type_label,
'sub_event_label' => $this->sub_event_label,
'is_recurring' => $this->is_recurring,
'is_festival' => $this->resource->isFestival(),
'is_sub_event' => $this->resource->isSubEvent(),
'is_flat_event' => $this->resource->isFlatEvent(),
'has_children' => $this->resource->hasChildren(),
'created_at' => $this->created_at->toIso8601String(),
'updated_at' => $this->updated_at->toIso8601String(),
'children_count' => $this->whenCounted('children'),
'organisation' => new OrganisationResource($this->whenLoaded('organisation')),
'parent' => new EventResource($this->whenLoaded('parent')),
'children' => EventResource::collection($this->whenLoaded('children')),
];
}
}