fix: send due parameters

This commit is contained in:
2025-12-12 19:59:04 +03:30
parent a49c6f078d
commit 3aab22fe2c
2 changed files with 44 additions and 42 deletions
+8 -16
View File
@@ -70,22 +70,14 @@ public function handle(): int
}
// Otherwise, send to all users that have this package
else {
$users = $packageName->users()->whereNotNull('package_name_user.fcm_token')->get();
foreach ($users as $user) {
$fcmToken = $user->packageNames()->where('package_names.id', $packageName->id)->first()->pivot->fcm_token;
if (!$fcmToken) continue;
SendPushToPackageJob::dispatch(
user: $user,
title: $reminder->title,
packageName: $packageName,
description: $reminder->description ?? '',
data: $reminder->data ?? []
);
}
}
// Just dispatch the job once for all users with this package
SendPushToPackageJob::dispatch(
$packageName,
$reminder->title,
$reminder->description ?? '',
$reminder->data ?? []
);
}
$reminder->last_repeat = now();
$reminder->save();