Skip to content

Commit 4f0e1ef

Browse files
authored
Merge pull request #147 from inertiajs/register-middleware-in-group
Automatically register middleware in "web" group
2 parents 0a9af99 + 9a9fd4d commit 4f0e1ef

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/ServiceProvider.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use Illuminate\Support\Collection;
88
use Illuminate\Contracts\Http\Kernel;
99
use Illuminate\Support\Facades\Blade;
10+
use Illuminate\Support\Facades\Config;
1011
use Illuminate\Support\Facades\Session;
1112
use Illuminate\Support\ServiceProvider as BaseServiceProvider;
1213

@@ -51,7 +52,10 @@ protected function registerRouterMacro()
5152

5253
protected function registerMiddleware()
5354
{
54-
$this->app[Kernel::class]->pushMiddleware(Middleware::class);
55+
$this->app[Kernel::class]->appendMiddlewareToGroup(
56+
Config::get('inertia.middleware_group', 'web'),
57+
Middleware::class
58+
);
5559
}
5660

5761
protected function shareValidationErrors()

0 commit comments

Comments
 (0)