*/ public function rules(): array { return [ 'source_event_id' => ['required', 'ulid', 'exists:events,id'], ]; } public function withValidator($validator): void { $validator->after(function ($validator) { $sourceEventId = $this->input('source_event_id'); if (!$sourceEventId) { return; } $sourceEvent = Event::find($sourceEventId); $targetEvent = $this->route('event'); if ($sourceEvent && $targetEvent && $sourceEvent->organisation_id !== $targetEvent->organisation_id) { $validator->errors()->add('source_event_id', 'Source event must belong to the same organisation.'); } }); } }