getLatest((int)Auth::user()['id'], 20); $unreadCount = $service->getUnreadCount((int)Auth::user()['id']); header('Content-Type: application/json; charset=utf-8'); echo json_encode([ 'items' => $items, 'unread_count' => $unreadCount, ], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); } public function readAll(): void { if (!Auth::check()) { http_response_code(403); echo 'Unauthorized'; return; } $service = new NotificationService(); $service->markAllRead((int)Auth::user()['id']); header('Content-Type: application/json; charset=utf-8'); echo json_encode(['success' => true], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); } }