File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change 77use App \Models \Asset ;
88use App \Models \Location ;
99use App \Models \Setting ;
10+ use App \Models \User ;
1011use Exception ;
1112use Illuminate \Support \Collection ;
1213use Illuminate \Support \Facades \Log ;
@@ -25,11 +26,11 @@ public function subscribe($events)
2526
2627 public function handle (CheckoutablesCheckedOutInBulk $ event ): void
2728 {
28- $ shouldSendEmailToUser = $ this ->shouldSendCheckoutEmailToUser ($ event ->assets );
29- $ shouldSendEmailToAlertAddress = $ this ->shouldSendEmailToAlertAddress ($ event ->assets );
30-
3129 $ notifiableUser = $ this ->getNotifiableUser ($ event );
3230
31+ $ shouldSendEmailToUser = $ this ->shouldSendCheckoutEmailToUser ($ notifiableUser , $ event ->assets );
32+ $ shouldSendEmailToAlertAddress = $ this ->shouldSendEmailToAlertAddress ($ event ->assets );
33+
3334 if ($ shouldSendEmailToUser && $ notifiableUser ) {
3435 try {
3536 Mail::to ($ notifiableUser )->send (new BulkAssetCheckoutMail (
@@ -65,8 +66,12 @@ public function handle(CheckoutablesCheckedOutInBulk $event): void
6566 }
6667 }
6768
68- private function shouldSendCheckoutEmailToUser (Collection $ assets ): bool
69+ private function shouldSendCheckoutEmailToUser (? User $ user , Collection $ assets ): bool
6970 {
71+ if (!$ user ->email ) {
72+ return false ;
73+ }
74+
7075 // @todo: how to handle assets having eula?
7176
7277 return $ this ->requiresAcceptance ($ assets );
You can’t perform that action at this time.
0 commit comments