diff --git a/app/Jobs/SendPushNotificationJob.php b/app/Jobs/SendPushNotificationJob.php index 9603125..9025c48 100644 --- a/app/Jobs/SendPushNotificationJob.php +++ b/app/Jobs/SendPushNotificationJob.php @@ -84,8 +84,8 @@ private function sendWebPush(): void $expiredEndpoints = []; foreach ($webPush->flush() as $report) { - if (! $report->isSuccess()) { - $expiredEndpoints[] = (string) $report->getRequest()->getUri(); + if ($report->isSubscriptionExpired()) { + $expiredEndpoints[] = $report->getEndpoint(); } } diff --git a/app/Services/System/PushSubscriptionService.php b/app/Services/System/PushSubscriptionService.php index 46bf2c7..59eed5e 100644 --- a/app/Services/System/PushSubscriptionService.php +++ b/app/Services/System/PushSubscriptionService.php @@ -10,10 +10,10 @@ public function updateOrCreateSubscription(array $validated, int $userId): void { PushSubscription::updateOrCreate( [ - 'user_id' => $userId, 'endpoint' => $validated['endpoint'], ], [ + 'user_id' => $userId, 'public_key' => $validated['publicKey'], 'auth_token' => $validated['authToken'], ]