@@ -28,24 +28,22 @@ public function subscribe($events)
2828 {
2929 $ events ->listen (
3030 AssetsTransferredInBulk::class,
31- 'App\Listeners\TransferrableListener @onTransfer '
31+ 'App\Listeners\TransferableListener @onTransfer '
3232 );
3333 }
3434 public function onTransfer ($ event ){
35- if ($ this ->shouldNotSendAnyNotifications ($ event ->transferrable )){
36- return ;
37- }
35+
3836 $ acceptance = $ this ->getTransferAcceptance ($ event );
3937
40- $ shouldSendEmailToUser = $ this ->shouldSendTransferEmailToUser ($ event ->transferrable );
38+ $ shouldSendEmailToUser = $ this ->shouldSendTransferEmailToUser ($ event ->transferable );
4139 $ shouldSendEmailToAlertAddress = $ this ->shouldSendEmailToAlertAddress ($ acceptance );
4240 $ shouldSendWebhookNotification = $ this ->shouldSendWebhookNotification ();
4341
4442 if (!$ shouldSendEmailToUser && !$ shouldSendEmailToAlertAddress && !$ shouldSendWebhookNotification ) {
4543 return ;
4644 }
4745 if ($ shouldSendEmailToUser || $ shouldSendEmailToAlertAddress ) {
48- $ mailable = new TransferredMail ($ event ->transferrable , $ event ->transferedTo , $ event ->transferedBy , $ acceptance , $ event ->transferred_at , $ event ->expected_checkin , $ event ->note );
46+ $ mailable = new TransferredMail ($ event ->transferable , $ event ->transferredTo , $ event ->admin , $ acceptance , $ event ->transferred_at , $ event ->expected_checkin , $ event ->note );
4947 $ notifiable = $ this ->getNotifiableUser ($ event );
5048 $ notifiableHasEmail = $ notifiable instanceof User && $ notifiable ->email ;
5149 $ shouldSendEmailToUser = $ shouldSendEmailToUser && $ notifiableHasEmail ;
@@ -93,7 +91,7 @@ private function getTransferAcceptance($event)
9391 }
9492
9593 $ acceptance = new CheckoutAcceptance ;
96- $ acceptance ->checkoutable ()->associate ($ event ->trasnferable );
94+ $ acceptance ->checkoutable ()->associate ($ event ->transferable );
9795 $ acceptance ->assignedTo ()->associate ($ event ->transferredTo );
9896
9997 $ acceptance ->qty = 1 ;
@@ -112,10 +110,7 @@ private function getTransferAcceptance($event)
112110
113111 return $ acceptance ;
114112 }
115- private function shouldNotSendAnyNotifications ($ transferable ): bool
116- {
117- return in_array (get_class ($ transferable ), $ this ->skipNotificationsFor );
118- }
113+
119114 private function shouldSendWebhookNotification (): bool
120115 {
121116 return Setting::getSettings () && Setting::getSettings ()->webhook_endpoint ;
0 commit comments