*/ public function rules(): array { $event = $this->route('event'); $eventIds = [$event->id]; if ($event->parent_event_id) { $eventIds[] = $event->parent_event_id; } elseif ($event->isFestival()) { $eventIds = array_merge($eventIds, $event->children()->pluck('id')->all()); } return [ 'availabilities' => ['required', 'array'], 'availabilities.*.time_slot_id' => [ 'required', 'ulid', Rule::exists('time_slots', 'id')->whereIn('event_id', $eventIds), ], 'availabilities.*.preference_level' => ['sometimes', 'integer', 'min:1', 'max:5'], ]; } }