Skip to content

Commit

Permalink
put middleware on the route
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonvarga committed Jan 26, 2024
1 parent 86f3484 commit a39e0ae
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
2 changes: 2 additions & 0 deletions routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down Expand Up @@ -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()) {
Expand Down
8 changes: 1 addition & 7 deletions src/StaticCaching/NoCache/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down

0 comments on commit a39e0ae

Please sign in to comment.