From 03f76a38b5d98db00db3f41357b1b5ec01fb4204 Mon Sep 17 00:00:00 2001 From: ARCANEDEV Date: Sun, 29 Jan 2017 10:27:30 +0000 Subject: [PATCH] Fixing the kernel's middleware --- src/Traits/LocalizationKernelTrait.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Traits/LocalizationKernelTrait.php b/src/Traits/LocalizationKernelTrait.php index c9cf5e0..ffb0e55 100644 --- a/src/Traits/LocalizationKernelTrait.php +++ b/src/Traits/LocalizationKernelTrait.php @@ -37,7 +37,7 @@ protected function dispatchToRouter() | ------------------------------------------------------------------------------------------------ */ /** - * Register middleware groups to router (since Laravel 5.2) + * Register middleware groups to router (since Laravel 5.2). */ protected function registerMiddlewareGroups() { @@ -49,12 +49,14 @@ protected function registerMiddlewareGroups() } /** - * Register middleware to router + * Register middleware to router. */ protected function registerMiddleware() { foreach ($this->routeMiddleware as $key => $middleware) { - $this->router->middleware($key, $middleware); + method_exists($this->router, 'aliasMiddleware') + ? $this->router->aliasMiddleware($key, $middleware) + : $this->router->middleware($key, $middleware);; } } }