Files
crewli/api/app/Http/Requests/Api/V1/VolunteerRegistrationRequest.php
bert.hausmans c21bc085e9 feat: registration section preferences with show_in_registration filtering and deduplication
Add show_in_registration and registration_description columns to festival_sections.
Registration form now shows deduplicated sections by name (across sub-events),
filtered by show_in_registration=true, grouped by category with card-based UI.
Section preferences use section_name instead of section_id.
Add GET/PUT registration-settings endpoints for festival-level bulk management.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-10 20:03:54 +02:00

56 lines
1.8 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Http\Requests\Api\V1;
use Illuminate\Foundation\Http\FormRequest;
final class VolunteerRegistrationRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
protected function prepareForValidation(): void
{
$user = auth('sanctum')->user();
if ($user) {
$this->merge([
'name' => $user->name,
'email' => $user->email,
'_authenticated' => true,
]);
}
}
/** @return array<string, mixed> */
public function rules(): array
{
return [
'name' => ['required_without:_authenticated', 'string', 'max:255'],
'email' => ['required_without:_authenticated', 'email', 'max:255'],
'phone' => ['nullable', 'string', 'max:50'],
'tshirt_size' => ['nullable', 'string', 'in:XS,S,M,L,XL,XXL,XXXL'],
'first_aid' => ['nullable', 'boolean'],
'allergies' => ['nullable', 'string', 'max:500'],
'access_requirements' => ['nullable', 'string', 'max:500'],
'driving_licence' => ['nullable', 'boolean'],
'motivation' => ['nullable', 'string', 'max:1000'],
'motivation_other' => ['nullable', 'string', 'max:500'],
'section_preferences' => ['nullable', 'array', 'max:5'],
'section_preferences.*.section_name' => ['required', 'string', 'max:255'],
'section_preferences.*.priority' => ['required', 'integer', 'min:1', 'max:5'],
'availabilities' => ['nullable', 'array'],
'availabilities.*.time_slot_id' => ['required', 'ulid', 'exists:time_slots,id'],
'availabilities.*.preference_level' => ['nullable', 'integer', 'min:1', 'max:5'],
];
}
}