Gustavo Zanatta hai 2 semanas
pai
achega
56c11481c9
Modificáronse 1 ficheiros con 4 adicións e 0 borrados
  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
     {
+        if (! array_key_exists('push_notifications_enabled', $user->getAttributes())) {
+            $user = $user->fresh() ?? $user;
+        }
+        
         if (! $user->push_notifications_enabled) {
             return;
         }