From 11208ee064c140610ccf94ae0c6e05be00e60c85 Mon Sep 17 00:00:00 2001 From: Marcus Moore Date: Wed, 13 Sep 2023 12:56:27 -0700 Subject: [PATCH] Guard against attempting to send notification to model that isn't notifiable --- app/Listeners/CheckoutableListener.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/Listeners/CheckoutableListener.php b/app/Listeners/CheckoutableListener.php index 09cb3ae8f..2f1d45fea 100644 --- a/app/Listeners/CheckoutableListener.php +++ b/app/Listeners/CheckoutableListener.php @@ -142,9 +142,11 @@ class CheckoutableListener $notifiables = collect(); /** - * Notify the user who checked out the item + * Notify who checked out the item as long as the model can route notifications */ - $notifiables->push($event->checkedOutTo); + if (method_exists($event->checkedOutTo, 'routeNotificationFor')) { + $notifiables->push($event->checkedOutTo); + } /** * Notify Admin users if the settings is activated