this one helps. Eloquent queries always return a collection, so you can easily use the filter function for this. After that call the first function to get the first element. If there are no elements in the collection, null will be returned. For example:
this one helps. This is how you would do it with relationship methods. You indeed need to use ->whereHas(), but you need to wrap both ->whereHas('addresses', ...) and ->orWhereHas('digits', ...) in a ->where(function ($q) ...) method.