Skip to content

Commit aa9daa0

Browse files
authored
[8.x] Add fullUrlWithoutQuery method to Request (#38482)
* add fullUrlWithoutQuery method to Request * StyleCI fixes
1 parent 5671af9 commit aa9daa0

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/Illuminate/Http/Request.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,23 @@ public function fullUrlWithQuery(array $query)
133133
: $this->fullUrl().$question.Arr::query($query);
134134
}
135135

136+
/**
137+
* Get the full URL for the request without the given query string parameters.
138+
*
139+
* @param array|string $query
140+
* @return string
141+
*/
142+
public function fullUrlWithoutQuery($keys)
143+
{
144+
$query = Arr::except($this->query(), $keys);
145+
146+
$question = $this->getBaseUrl().$this->getPathInfo() === '/' ? '/?' : '?';
147+
148+
return count($query) > 0
149+
? $this->url().$question.Arr::query($query)
150+
: $this->url();
151+
}
152+
136153
/**
137154
* Get the current path info for the request.
138155
*

0 commit comments

Comments
 (0)