timeWindow->getUploadsPerDay(); return view('admin.early-growth.index', [ 'status' => EarlyGrowth::status(), 'mode' => EarlyGrowth::mode(), 'uploads_per_day' => $uploadsPerDay, 'window_days' => $this->timeWindow->getTrendingWindowDays(30), 'activity' => $this->activityLayer->getSignals(), 'cache_keys' => [ 'egs.uploads_per_day', 'egs.auto_disable_check', 'egs.spotlight.*', 'egs.curated.*', 'egs.grid_filler.*', 'egs.activity_signals', 'homepage.fresh.*', 'discover.trending.*', 'discover.rising.*', ], 'env_toggles' => [ ['key' => 'NOVA_EARLY_GROWTH_ENABLED', 'current' => env('NOVA_EARLY_GROWTH_ENABLED', 'false')], ['key' => 'NOVA_EARLY_GROWTH_MODE', 'current' => env('NOVA_EARLY_GROWTH_MODE', 'off')], ['key' => 'NOVA_EGS_ADAPTIVE_WINDOW', 'current' => env('NOVA_EGS_ADAPTIVE_WINDOW', 'true')], ['key' => 'NOVA_EGS_GRID_FILLER', 'current' => env('NOVA_EGS_GRID_FILLER', 'true')], ['key' => 'NOVA_EGS_SPOTLIGHT', 'current' => env('NOVA_EGS_SPOTLIGHT', 'true')], ['key' => 'NOVA_EGS_ACTIVITY_LAYER', 'current' => env('NOVA_EGS_ACTIVITY_LAYER', 'false')], ], ]); } /** * DELETE /admin/early-growth/cache * Flush all EGS-related cache keys so new config changes take effect immediately. */ public function flushCache(Request $request): RedirectResponse { $keys = [ 'egs.uploads_per_day', 'egs.auto_disable_check', 'egs.activity_signals', ]; // Flush the EGS daily spotlight caches for today $today = now()->format('Y-m-d'); foreach ([6, 12, 18, 24] as $n) { Cache::forget("egs.spotlight.{$today}.{$n}"); Cache::forget("egs.curated.{$today}.{$n}.7"); } // Flush fresh/trending homepage sections foreach ([6, 8, 10, 12] as $limit) { foreach (['off', 'light', 'aggressive'] as $mode) { Cache::forget("homepage.fresh.{$limit}.egs-{$mode}"); Cache::forget("homepage.fresh.{$limit}.std"); } Cache::forget("homepage.trending.{$limit}"); Cache::forget("homepage.rising.{$limit}"); } // Flush key keys foreach ($keys as $key) { Cache::forget($key); } return redirect()->route('admin.early-growth.index') ->with('success', 'Early Growth System cache flushed. Changes will take effect on next page load.'); } /** * GET /admin/early-growth/status (JSON — for monitoring/healthcheck) */ public function status(): JsonResponse { return response()->json([ 'egs' => EarlyGrowth::status(), 'uploads_per_day' => $this->timeWindow->getUploadsPerDay(), 'window_days' => $this->timeWindow->getTrendingWindowDays(30), ]); } }