*/ public function rules(): array { $organisation = $this->route('organisation'); return [ 'match_ids' => ['required', 'array', 'min:1', 'max:100'], 'match_ids.*' => [ 'required', 'string', Rule::exists('person_identity_matches', 'id')->where(function ($query) use ($organisation) { $query->whereIn('person_id', function ($q) use ($organisation) { $q->select('id')->from('persons') ->whereIn('event_id', function ($q2) use ($organisation) { $q2->select('id')->from('events') ->where('organisation_id', $organisation->id); }); }); }), ], ]; } }