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

This commit is contained in:
Marcus Moore 2023-09-13 12:56:27 -07:00
parent f6a11ac0ed
commit 11208ee064

View file

@ -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