feat: add fcm_token for update

This commit is contained in:
2025-12-12 13:19:05 +03:30
parent 771e0b41b1
commit 14c531274e
3 changed files with 736 additions and 722 deletions
+8 -1
View File
@@ -36,8 +36,14 @@ public function handle(): void
->withServiceAccount($firebaseFile);
$push = $factory->createMessaging();
$fcmToken = $this->user->packageNames()->where('package_names.id', $this->packageName->id)->first()->pivot->fcm_token;
if (!$fcmToken) {
return;
}
$message = CloudMessage::fromArray([
'token' => $this->user->packageNames()->where('package_names.id', $this->packageName->id)->first()->pivot->fcm_token,
'token' => $fcmToken,
'notification' => [
'title' => $this->title,
'body' => $this->description,
@@ -46,6 +52,7 @@ public function handle(): void
]);
$push->send($message);
}
/**