This commit is contained in:
lizandrogd
2026-01-21 02:49:42 -05:00
parent 845762f916
commit cec91ff45a
6 changed files with 209 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
<?php
require_once '../config/config.php';
requireAuthentication();
header('Content-Type: application/json; charset=utf-8');
try {
$input = json_decode(file_get_contents('php://input'), true) ?: $_POST;
$id = isset($input['id']) ? intval($input['id']) : 0;
if (!$id) {
http_response_code(400);
echo json_encode(['success' => false, 'error' => 'id required']);
exit;
}
$db = Database::getInstance();
$db->update('notifications', ['is_read' => 1], 'id = :id', ['id' => $id]);
echo json_encode(['success' => true]);
} catch (Exception $e) {
http_response_code(500);
echo json_encode(['success' => false, 'error' => $e->getMessage()]);
}