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
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Reviewed-on: #157
This commit was merged in pull request #157.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user