Refactor PHP | Laravel Code, Optimisation needed to make code clean
You could exploit Laravel collections to achieve what you need.

Most of your code is checking for the presence/absence of props on your arrays. Laravel internally exposes and uses the Illuminate\Support\Arr class that contains a lot of useful methods to work with arrays without the hassles of checking for key existance.
It also allows you to use dot notation to get nested properties in a really simple way.

Laravel collection methods (documentation)  use this class where needed. Therefore, the refactored code would become really intuitive and should look like this (it may need a little bit of tweaking based on your userNotificationPreference and preferences arrays and how you retrieve them from the model:

$recipients-&gt;map-&gt;getUser()
    -&gt;where("userNotificationPreference.preferences.{$sendMethod}", true)
    -&gt;where("userNotificationPreference.preferences.specific-templates.0.{$notification-&gt;getTemplateCode()}.0.{$sendMethod}", true);


Note that I used -&gt;map-&gt;getUser() that would be equivalent to:

$recipients-&gt;map(function ($recipient) {
    return $recipient-&gt;getUser();
})


However, if you really need to pluck the user instance through the user repository then you can do:

$recipients-&gt;map(function ($recipient) use ($userRepository) {
    return $userRepository-&gt;findByParams([
        'email' =&gt; $recipient-&gt;getUser()-&gt;email
    ]);
})-&gt;where(...);


and chain the where calls after that.

If any part of my code is unclear or doesn't work, let me know in the comments and I'll explain/fix it.