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
1.5 KiB
PHP
48 lines
1.5 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Http\Requests\Api\V1;
|
|
|
|
use App\Enums\RegistrationFieldType;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Validation\Rule;
|
|
|
|
final class StoreRegistrationFieldTemplateRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
/** @return array<string, mixed> */
|
|
public function rules(): array
|
|
{
|
|
$fieldType = $this->input('field_type');
|
|
$type = RegistrationFieldType::tryFrom($fieldType);
|
|
|
|
return [
|
|
'label' => ['required', 'string', 'max:255'],
|
|
'field_type' => ['required', Rule::in(array_column(RegistrationFieldType::cases(), 'value'))],
|
|
'options' => [
|
|
$type?->requiresOptions() ? 'required' : 'nullable',
|
|
$type?->prohibitsOptions() ? 'prohibited' : 'nullable',
|
|
'array',
|
|
],
|
|
'options.*' => ['string', 'max:255'],
|
|
'tag_category' => [
|
|
$type === RegistrationFieldType::TAG_PICKER ? 'nullable' : 'prohibited',
|
|
'string',
|
|
'max:50',
|
|
],
|
|
'is_required' => ['nullable', 'boolean'],
|
|
'is_filterable' => ['nullable', 'boolean'],
|
|
'is_portal_visible' => ['nullable', 'boolean'],
|
|
'is_admin_only' => ['nullable', 'boolean'],
|
|
'section' => ['nullable', 'string', 'max:100'],
|
|
'help_text' => ['nullable', 'string', 'max:5000'],
|
|
'sort_order' => ['nullable', 'integer', 'min:0'],
|
|
];
|
|
}
|
|
}
|