meetupEvent->refresh(); $attendees = collect($this->meetupEvent->attendees); $mightAttendees = collect($this->meetupEvent->might_attendees); $isInAttendees = $attendees ->contains(fn($v) => str($v) ->after('|') ->lower() ->toString() === str($value) ->lower() ->toString()); $isInMightAttendees = $mightAttendees ->contains(fn($v) => str($v) ->after('|') ->lower() ->toString() === str($value) ->lower() ->toString()); if ($isInAttendees) { $fail('The name is already taken.'); } if ($isInMightAttendees) { $fail('The name is already taken.'); } } }