From a39e0ae488f616dde4e86256e02629d6580df277 Mon Sep 17 00:00:00 2001 From: Jason Varga Date: Fri, 26 Jan 2024 12:41:50 -0500 Subject: [PATCH] put middleware on the route --- routes/web.php | 2 ++ src/StaticCaching/NoCache/Controller.php | 8 +------- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/routes/web.php b/routes/web.php index 4cfaf5af8c..74c56707a7 100755 --- a/routes/web.php +++ b/routes/web.php @@ -15,6 +15,7 @@ use Statamic\Http\Middleware\CP\AuthGuard as CPAuthGuard; use Statamic\Statamic; use Statamic\StaticCaching\NoCache\Controller as NoCacheController; +use Statamic\StaticCaching\NoCache\NoCacheLocalize; Route::name('statamic.')->group(function () { Route::group(['prefix' => config('statamic.routes.action')], function () { @@ -45,6 +46,7 @@ Route::prefix(config('statamic.routes.action')) ->post('nocache', NoCacheController::class) + ->middleware(NoCacheLocalize::class) ->withoutMiddleware('App\Http\Middleware\VerifyCsrfToken'); if (OAuth::enabled()) { diff --git a/src/StaticCaching/NoCache/Controller.php b/src/StaticCaching/NoCache/Controller.php index 991779fa3d..f3e4e51a95 100644 --- a/src/StaticCaching/NoCache/Controller.php +++ b/src/StaticCaching/NoCache/Controller.php @@ -3,17 +3,11 @@ namespace Statamic\StaticCaching\NoCache; use Illuminate\Http\Request; -use Illuminate\Routing\Controller as BaseController; use Statamic\StaticCaching\Replacers\NoCacheReplacer; use Statamic\Support\Str; -class Controller extends BaseController +class Controller { - public function __construct() - { - $this->middleware(NoCacheLocalize::class); - } - public function __invoke(Request $request, Session $session) { $url = $request->input('url');