Skip to content

Commit

Permalink
[8.x] Add fullUrlWithoutQuery method to Request (laravel#38482)
Browse files Browse the repository at this point in the history
* add fullUrlWithoutQuery method to Request

* StyleCI fixes
  • Loading branch information
alisaleem27 authored and victorvilella committed Oct 12, 2021
1 parent f63de7f commit 942b688
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/Illuminate/Http/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down

0 comments on commit 942b688

Please sign in to comment.