From 31444aaae66d52b080eeea4f7e9006e39d0f847d Mon Sep 17 00:00:00 2001 From: Ali Saleem Date: Fri, 20 Aug 2021 17:34:26 +0100 Subject: [PATCH 1/2] add fullUrlWithoutQuery method to Request --- src/Illuminate/Http/Request.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/Illuminate/Http/Request.php b/src/Illuminate/Http/Request.php index 0dd1208778d6..0c32ca890128 100644 --- a/src/Illuminate/Http/Request.php +++ b/src/Illuminate/Http/Request.php @@ -132,6 +132,23 @@ public function fullUrlWithQuery(array $query) ? $this->url().$question.Arr::query(array_merge($this->query(), $query)) : $this->fullUrl().$question.Arr::query($query); } + + /** + * Get the full URL for the request without the given query string parameters. + * + * @param array|string $query + * @return string + */ + public function fullUrlWithoutQuery($keys) + { + $query = Arr::except($this->query(), $keys); + + $question = $this->getBaseUrl().$this->getPathInfo() === '/' ? '/?' : '?'; + + return count($query) > 0 + ? $this->url().$question.Arr::query($query) + : $this->url(); + } /** * Get the current path info for the request. From fe2d60986e16792aaabf48f7e3ef8cb0ac27a0e2 Mon Sep 17 00:00:00 2001 From: Ali Saleem Date: Fri, 20 Aug 2021 17:40:48 +0100 Subject: [PATCH 2/2] StyleCI fixes --- src/Illuminate/Http/Request.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Http/Request.php b/src/Illuminate/Http/Request.php index 0c32ca890128..dc03374f6651 100644 --- a/src/Illuminate/Http/Request.php +++ b/src/Illuminate/Http/Request.php @@ -132,7 +132,7 @@ public function fullUrlWithQuery(array $query) ? $this->url().$question.Arr::query(array_merge($this->query(), $query)) : $this->fullUrl().$question.Arr::query($query); } - + /** * Get the full URL for the request without the given query string parameters. *