Implement EAV system for dynamic event-specific registration fields with organisation-level templates, person section preferences with priority ranking, and TagSyncService for deferred tag_picker sync. New tables: registration_field_templates, registration_form_fields, person_field_values, person_section_preferences. New columns: persons.remarks, events.registration_show_section_preferences, events.registration_show_availability. 58 tests, 126 assertions — all 432 tests pass (zero regressions). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
48 lines
2.1 KiB
PHP
48 lines
2.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Http\Resources\Api\V1;
|
|
|
|
use App\Models\Event;
|
|
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,
|
|
'allowed_transitions' => Event::STATUS_TRANSITIONS[$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,
|
|
'registration_banner_url' => $this->registration_banner_url,
|
|
'registration_welcome_text' => $this->registration_welcome_text,
|
|
'registration_logo_url' => $this->registration_logo_url,
|
|
'registration_show_section_preferences' => $this->registration_show_section_preferences,
|
|
'registration_show_availability' => $this->registration_show_availability,
|
|
'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')),
|
|
];
|
|
}
|
|
}
|