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>
35 lines
1.0 KiB
PHP
35 lines
1.0 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Http\Resources\Api\V1;
|
|
|
|
use App\Enums\RegistrationFieldType;
|
|
use App\Models\PersonTag;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
final class PersonFieldValueResource extends JsonResource
|
|
{
|
|
public function toArray(Request $request): array
|
|
{
|
|
$field = $this->registrationFormField;
|
|
|
|
return [
|
|
'field_slug' => $field?->slug,
|
|
'field_label' => $field?->label,
|
|
'field_type' => $field?->field_type?->value,
|
|
'value' => $this->value,
|
|
'selected_options' => $this->selected_options,
|
|
'tag_names' => $this->when(
|
|
$field?->field_type === RegistrationFieldType::TAG_PICKER && !empty($this->selected_options),
|
|
function () {
|
|
return PersonTag::whereIn('id', $this->selected_options ?? [])
|
|
->pluck('name')
|
|
->all();
|
|
}
|
|
),
|
|
];
|
|
}
|
|
}
|