From e467ce912b1725f8baf14340ffa7e205e9059d12 Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 17 May 2022 06:56:43 -0700 Subject: [PATCH] Added some debugging and comments Signed-off-by: snipe --- app/Listeners/CheckoutableListener.php | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/app/Listeners/CheckoutableListener.php b/app/Listeners/CheckoutableListener.php index 93d16ff5bc..22006d1cc0 100644 --- a/app/Listeners/CheckoutableListener.php +++ b/app/Listeners/CheckoutableListener.php @@ -24,10 +24,14 @@ use Illuminate\Support\Facades\Notification; class CheckoutableListener { /** - * Notify the user about the checked out checkoutable + * Notify the user about the checked out checkoutable and add a record to the + * checkout_requests table. */ public function onCheckedOut($event) { + + \Log::debug('onCheckedOut in the Checkoutable listener fired'); + /** * When the item wasn't checked out to a user, we can't send notifications */ @@ -58,14 +62,12 @@ class CheckoutableListener */ public function onCheckedIn($event) { - \Log::debug('checkin fired'); + \Log::debug('onCheckedIn in the Checkoutable listener fired'); /** * When the item wasn't checked out to a user, we can't send notifications */ if (! $event->checkedOutTo instanceof User) { - \Log::debug('checked out to not a user'); - return; } @@ -81,16 +83,14 @@ class CheckoutableListener $acceptance->delete(); } } - \Log::debug('checked out to a user'); + + // Use default locale if (! $event->checkedOutTo->locale) { - \Log::debug('Use default settings locale'); Notification::locale(Setting::getSettings()->locale)->send( $this->getNotifiables($event), $this->getCheckinNotification($event) ); } else { - \Log::debug('Use user locale? I do not think this works as expected yet'); - // \Log::debug(print_r($this->getNotifiables($event), true)); Notification::send( $this->getNotifiables($event), $this->getCheckinNotification($event) @@ -151,10 +151,6 @@ class CheckoutableListener private function getCheckinNotification($event) { - // $model = get_class($event->checkoutable); - - - $notificationClass = null; switch (get_class($event->checkoutable)) {