Route::get('/test-ddp-trending', function () { try { $controller = new \App\Http\Controllers\Admin\StatsController(request()); // Test with reflection to call the private method $reflection = new ReflectionClass($controller); $method = $reflection->getMethod('getTrendingFromDDP'); $method->setAccessible(true); $result = $method->invoke($controller, 30, 'all'); return response()->json([ 'success' => true, 'trending_up_count' => count($result['trending_up']), 'trending_down_count' => count($result['trending_down']), 'memory_usage' => memory_get_usage(true), 'peak_memory' => memory_get_peak_usage(true) ]); } catch (Exception $e) { return response()->json([ 'success' => false, 'error' => $e->getMessage(), 'file' => $e->getFile(), 'line' => $e->getLine(), 'memory_usage' => memory_get_usage(true), 'peak_memory' => memory_get_peak_usage(true) ], 500); } });