prepare("INSERT INTO notifications (id, user_id, title, message, type, is_read, created_at) VALUES (?, ?, ?, ?, ?, 0, NOW())"); $stmt->execute([ \Ramsey\Uuid\Uuid::uuid4()->toString(), $userId, $title, $message, $type ]); // Here we could also trigger WebSockets or push notifications if implemented } catch (Throwable $e) { echo "[!] Notification failed for user {$userId}: " . $e->getMessage() . "\n"; throw $e; } } }