Skip to content

Commit bd0f315

Browse files
committed
Если в Kernel определены middleware для авторизации в админ панель, то не переопредлеляем
1 parent d3121a9 commit bd0f315

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/Http/Kernel.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,22 @@ class Kernel extends HttpKernel
1111
/**
1212
* Create a new HTTP kernel instance.
1313
*
14-
* @param \Illuminate\Contracts\Foundation\Application $app
15-
* @param \Illuminate\Routing\Router $router
14+
* @param \Illuminate\Contracts\Foundation\Application $app
15+
* @param \Illuminate\Routing\Router $router
16+
*
1617
* @return void
1718
*/
1819
public function __construct(Application $app, Router $router)
1920
{
2021
$this->middleware[] = \KodiCMS\CMS\Http\Middleware\PostJson::class;
2122

22-
$this->routeMiddleware['backend.auth'] = \App\Http\Middleware\Authenticate::class;
23-
$this->routeMiddleware['backend.guest'] = \App\Http\Middleware\RedirectIfAuthenticated::class;
23+
if (! isset($this->routeMiddleware['backend.auth'])) {
24+
$this->routeMiddleware['backend.auth'] = \App\Http\Middleware\Authenticate::class;
25+
}
26+
27+
if (! isset($this->routeMiddleware['backend.guest'])) {
28+
$this->routeMiddleware['backend.guest'] = \App\Http\Middleware\RedirectIfAuthenticated::class;
29+
}
2430

2531
parent::__construct($app, $router);
2632
}

0 commit comments

Comments
 (0)