Ver código fonte

Merge remote-tracking branch 'refs/remotes/origin/development' into development

Gustavo Mantovani 1 semana atrás
pai
commit
8aab83a564
1 arquivos alterados com 7 adições e 3 exclusões
  1. 7 3
      app/Services/PushNotificationService.php

+ 7 - 3
app/Services/PushNotificationService.php

@@ -8,6 +8,7 @@ use App\Models\User;
 use App\Notifications\Push\BasePushNotification;
 use Illuminate\Support\Collection;
 use Kreait\Firebase\Contract\Messaging;
+use Kreait\Firebase\Messaging\AndroidConfig;
 use Kreait\Firebase\Messaging\CloudMessage;
 use Kreait\Firebase\Messaging\Notification;
 
@@ -31,9 +32,12 @@ class PushNotificationService
             return;
         }
 
-        $message = CloudMessage::new()->withNotification(
-            Notification::create($notification->title(), $notification->body())
-        );
+        $message = CloudMessage::new()
+            ->withNotification(Notification::create($notification->title(), $notification->body()))
+            ->withAndroidConfig(AndroidConfig::fromArray([
+                'notification' => ['channel_id' => 'default'],
+                'priority' => 'high',
+            ]));
 
         $report = $this->messaging->sendMulticast($message, $tokens);