From 9d43c6a6d82c8ba892b1b79c2bc7ad5527f50e52 Mon Sep 17 00:00:00 2001 From: "Barry vd. Heuvel" Date: Mon, 30 Dec 2024 10:17:16 +0100 Subject: [PATCH] Check web middleware (#1712) --- src/ServiceProvider.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ServiceProvider.php b/src/ServiceProvider.php index 2d5f02c8..fe8189c5 100644 --- a/src/ServiceProvider.php +++ b/src/ServiceProvider.php @@ -134,8 +134,11 @@ protected function getConfigPath() */ protected function registerMiddleware($middleware) { + /** @var \Illuminate\Foundation\Http\Kernel $kernel */ $kernel = $this->app[Kernel::class]; $kernel->pushMiddleware($middleware); - $kernel->appendMiddlewareToGroup('web', $middleware); + if (isset($kernel->getMiddlewareGroups()['web'])) { + $kernel->appendMiddlewareToGroup('web', $middleware); + } } }