Gustavo Zanatta 2 viikkoa sitten
vanhempi
commit
56c11481c9
1 muutettua tiedostoa jossa 4 lisäystä ja 0 poistoa
  1. 4 0
      app/Services/PushNotificationService.php

+ 4 - 0
app/Services/PushNotificationService.php

@@ -22,6 +22,10 @@ class PushNotificationService
      */
      */
     public function sendToUser(User $user, BasePushNotification $notification): void
     public function sendToUser(User $user, BasePushNotification $notification): void
     {
     {
+        if (! array_key_exists('push_notifications_enabled', $user->getAttributes())) {
+            $user = $user->fresh() ?? $user;
+        }
+        
         if (! $user->push_notifications_enabled) {
         if (! $user->push_notifications_enabled) {
             return;
             return;
         }
         }