Added native os notifications

This commit is contained in:
2026-07-01 22:11:24 +10:00
parent d1b50e2f1a
commit 84379baf6a
19 changed files with 213 additions and 39 deletions
+9
View File
@@ -3,12 +3,21 @@ namespace App\Observers;
use App\Events\NotificationCreated;
use App\Models\Notification;
use App\Notifications\PushNotification;
class NotificationObserver
{
public function created(Notification $notification): void
{
\Log::info('Notification created: ' . $notification->id);
broadcast(new NotificationCreated($notification));
try {
$notification->user->notify(new \App\Notifications\PushNotification($notification));
\Log::info('WebPush notify() called for user ' . $notification->user_id);
} catch (\Throwable $e) {
\Log::error('WebPush send failed: ' . $e->getMessage(), ['exception' => $e]);
}
}
}