up
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
require_once '../config/config.php';
|
||||
requireAuthentication();
|
||||
header('Content-Type: application/json; charset=utf-8');
|
||||
|
||||
try {
|
||||
$db = Database::getInstance();
|
||||
$limit = isset($_GET['limit']) ? intval($_GET['limit']) : 20;
|
||||
|
||||
$rows = $db->fetchAll(
|
||||
"SELECT id, user_id, type, message, data, is_read, created_at FROM notifications WHERE is_read = 0 ORDER BY created_at DESC LIMIT ?",
|
||||
[$limit]
|
||||
);
|
||||
|
||||
echo json_encode(['success' => true, 'data' => $rows]);
|
||||
} catch (Exception $e) {
|
||||
http_response_code(500);
|
||||
echo json_encode(['success' => false, 'error' => $e->getMessage()]);
|
||||
}
|
||||
Reference in New Issue
Block a user