fix: per package fixed

This commit is contained in:
2025-12-12 19:27:56 +03:30
parent e5831b86d2
commit 882d26337c
3 changed files with 112 additions and 12 deletions
+8 -1
View File
@@ -36,8 +36,15 @@ public function handle(): void
->withServiceAccount($firebaseFile);
$push = $factory->createMessaging();
$fcmToken = $this->user->packageNames()->where('package_names.id', $this->packageName->id)->first()->pivot->fcm_token;
$relation = $this->user->packageNames()
->where('package_names.id', $this->packageName->id)
->first();
if (!$relation || !$relation->pivot?->fcm_token) {
return; // skip if no token
}
$fcmToken = $relation->pivot->fcm_token;
if (!$fcmToken) {
return;
}