@@ -74,13 +74,17 @@ public function onCheckedOut($event)
7474 * 2. The item has a EULA
7575 * 3. The item should send an email at check-in/check-out
7676 */
77- if ( $ notifiable instanceof User && $ notifiable -> email != '' ) {
77+
7878 if ($ event ->checkoutable ->requireAcceptance () || $ event ->checkoutable ->getEula () ||
7979 (method_exists ($ event ->checkoutable , 'checkin_email ' ) && $ event ->checkoutable ->checkin_email ())) {
80- Mail::to ($ notifiable )->cc ($ ccEmails )->send ($ mailable );
80+ if (!empty ($ notifiable ->email )) {
81+ Mail::to ($ notifiable )->cc ($ ccEmails )->send ($ mailable );
82+ } else {
83+ Mail::cc ($ ccEmails )->send ($ mailable );
84+ }
8185 Log::info ('Sending email, Locale: ' . ($ event ->checkedOutTo ->locale ?? 'default ' ));
8286 }
83- }
87+
8488// Send Webhook notification
8589 if ($ this ->shouldSendWebhookNotification ()) {
8690 if (Setting::getSettings ()->webhook_selected === 'microsoft ' ) {
@@ -148,13 +152,16 @@ public function onCheckedIn($event)
148152 * 3. The item should send an email at check-in/check-out
149153 */
150154
151- if ($ notifiable instanceof User && $ notifiable ->email != '' ) {
152155 if ($ event ->checkoutable ->requireAcceptance () || $ event ->checkoutable ->getEula () ||
153156 (method_exists ($ event ->checkoutable , 'checkin_email ' ) && $ event ->checkoutable ->checkin_email ())) {
154- Mail::to ($ notifiable )->cc ($ ccEmails )->send ($ mailable );
157+ if (!empty ($ notifiable ->email )) {
158+ Mail::to ($ notifiable )->cc ($ ccEmails )->send ($ mailable );
159+ } else {
160+ Mail::cc ($ ccEmails )->send ($ mailable );
161+ }
155162 Log::info ('Sending email, Locale: ' . $ event ->checkedOutTo ->locale );
156163 }
157- }
164+
158165 // Send Webhook notification
159166 if ($ this ->shouldSendWebhookNotification ()) {
160167 Notification::route (Setting::getSettings ()->webhook_selected , Setting::getSettings ()->webhook_endpoint )
0 commit comments