user(); if ($user) { $this->merge([ 'first_name' => $user->first_name, 'last_name' => $user->last_name, 'email' => $user->email, '_authenticated' => true, ]); } } /** @return array */ public function rules(): array { return [ 'first_name' => ['required_without:_authenticated', 'string', 'max:255'], 'last_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'], ]; } }