diff --git a/src/Illuminate/Http/Request.php b/src/Illuminate/Http/Request.php index 0dd1208778d6..dc03374f6651 100644 --- a/src/Illuminate/Http/Request.php +++ b/src/Illuminate/Http/Request.php @@ -133,6 +133,23 @@ public function fullUrlWithQuery(array $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. *