feat: add fcm_token for update
This commit is contained in:
@@ -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);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user