user->role ?? '') !== 'super_admin') { Response::error('غير مصرح', 'FORBIDDEN', 403); return; } $db = Database::getInstance(); $stmt = $db->prepare("SELECT COUNT(*) as count FROM tenants"); $stmt->execute(); $totalTenants = $stmt->fetch()['count']; $stmt = $db->prepare("SELECT COUNT(*) as count FROM invoices"); $stmt->execute(); $totalInvoices = $stmt->fetch()['count']; // Simple Health Check $redisHealth = 'ok'; try { $redis = \App\Core\Redis::getInstance(); $redis->ping(); } catch (\Throwable $e) { $redisHealth = 'failed'; } Response::json([ 'success' => true, 'data' => [ 'total_tenants' => $totalTenants, 'total_invoices' => $totalInvoices, 'system_health' => [ 'database' => 'ok', 'redis' => $redisHealth ] ] ]); } }