From c718c2f07ded41b587b522e30687aa4fe56379d7 Mon Sep 17 00:00:00 2001 From: ARCANEDEV Date: Wed, 24 Aug 2016 18:56:11 +0100 Subject: [PATCH 1/2] Update the LocalizationRedirect middleware Update `$request->url()` to `$request->fullUrl()` to keep all the request data --- src/Middleware/LocalizationRedirect.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Middleware/LocalizationRedirect.php b/src/Middleware/LocalizationRedirect.php index a819531..49737ae 100644 --- a/src/Middleware/LocalizationRedirect.php +++ b/src/Middleware/LocalizationRedirect.php @@ -65,7 +65,7 @@ protected function getRedirectionUrl(Request $request) $this->getCurrentLocale() !== $this->getDefaultLocale() || ! $this->hideDefaultLocaleInURL() ) { - return localization()->getLocalizedURL(session('locale'), $request->path()); + return localization()->getLocalizedURL(session('locale'), $request->fullUrl()); } return false; From 829cd669da6a6ec57f47413971bd4a38f17fcec9 Mon Sep 17 00:00:00 2001 From: ARCANEDEV Date: Wed, 24 Aug 2016 18:56:55 +0100 Subject: [PATCH 2/2] Updating the Url Utility Class --- src/Utilities/Url.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/Utilities/Url.php b/src/Utilities/Url.php index d0ccff2..15069fd 100644 --- a/src/Utilities/Url.php +++ b/src/Utilities/Url.php @@ -4,7 +4,6 @@ use Arcanedev\Localization\Contracts\UrlInterface; use Illuminate\Http\Request; use Illuminate\Routing\Route; -use Illuminate\Routing\Router; /** * Class Url @@ -29,9 +28,6 @@ class Url implements UrlInterface */ public static function extractAttributes($url = false) { - /** @var Router $router */ - $router = app('router'); - $parse = parse_url($url); $path = isset($parse['path']) ? explode('/', $parse['path']) : []; $url = []; @@ -40,6 +36,9 @@ public static function extractAttributes($url = false) if ( ! empty($segment)) $url[] = $segment; } + /** @var \Illuminate\Routing\Router $router */ + $router = app('router'); + return self::extractAttributesFromRoutes($url, $router->getRoutes()); } @@ -194,8 +193,6 @@ private static function extractAttributesFromSegment($url, $path, $i, $j, $segme * Check parsed URL. * * @param array $parsed - * - * @return array */ private static function checkParsedUrl(array &$parsed) {