Skip to content

A free open source IT asset/license management system

Guard against attempting to send notification to model that isn't notifiable

Marcus Moore11208ee064c1
diff --git a/app/Listeners/CheckoutableListener.php b/app/Listeners/CheckoutableListener.php
index 09cb3ae8f2..2f1d45feac 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