Compare commits

...

2 Commits

Author SHA1 Message Date
1e208bfd7f Merge pull request 'Refactor push notification logic in afterSave method' (#157) from ranjith-dev into master
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Reviewed-on: #157
2026-01-30 06:36:02 +00:00
dhanabalan
dd7111a8d9 Refactor push notification logic in afterSave method
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Gemini PR Review / Gemini PR Review (pull_request) Has been cancelled
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Has been cancelled
Laravel Larastan / larastan (pull_request) Has been cancelled
Laravel Pint / pint (pull_request) Has been cancelled
2026-01-30 12:05:49 +05:30

View File

@@ -104,31 +104,50 @@ class EditRfqTransporterBid extends EditRecord
// );
// }
foreach ($users as $user) {
// foreach ($users as $user) {
Log::info('Checking push subscription for user', [
'user_id' => $user->id,
'name' => $user->name,
'subscription_count' => $user->pushSubscriptions()->count(),
]);
if ($user->pushSubscriptions()->exists()) {
// Log::info('Checking push subscription for user', [
// 'user_id' => $user->id,
// 'name' => $user->name,
// 'subscription_count' => $user->pushSubscriptions()->count(),
// ]);
// if ($user->pushSubscriptions()->exists()) {
Log::info('Sending push notification', [
'user_id' => $user->id,
]);
$user->notify(
new PushAlertNotification(
// Log::info('Sending push notification', [
// 'user_id' => $user->id,
// ]);
// $user->notify(
// new PushAlertNotification(
// 'Rank Updated',
// $body
// )
// );
// }
// else {
// Log::warning('User has NO push subscription', [
// 'user_id' => $user->id,
// ]);
// }
// }
foreach ($users as $user)
{
$subscriptions = $user->pushSubscriptions;
Log::info('Sending push', [
'user_id' => $user->id,
'subscription_count' => $subscriptions->count(),
]);
foreach ($subscriptions as $subscription) {
\Notification::route('webpush', $subscription)
->notify(new PushAlertNotification(
'Rank Updated',
$body
)
);
}
else {
Log::warning('User has NO push subscription', [
'user_id' => $user->id,
]);
));
}
}
}
protected function getHeaderActions(): array