Is there a Laravel way to get the current path of a Request with its query parameters?
For instance, for the URL:
http://www.example.com/one/two?key=value
Request::getPathInfo()
would return /one/two
.
Request::url()
would return http://www.example.com/one/two
.
The desired output is /one/two?key=value
.
Laravel 4.5
Just use
It will return the full url
You can extract the Querystring with str_replace
Or you can get a array of all the queries with
Laravel >5.1
Just use
It will return the full url
You can extract the Querystring with str_replace
Or you can get a array of all the queries with
Get the flag parameter from the URL string http://cube.wisercapital.com/hf/create?flag=1
Try to use the following:
$request->fullUrl()
will also work if you are injectingIllumitate\Http\Request
.Get the current URL including the query string.