Laravel Request getting current path with query string
Try to use the following:
\Request::getRequestUri()
Laravel 4.5
Just use
Request::fullUrl()
It will return the full url
You can extract the Querystring with str_replace
str_replace(Request::url(), '', Request::fullUrl())
Or you can get a array of all the queries with
Request::query()
Laravel >5.1
Just use
$request->fullUrl()
It will return the full url
You can extract the Querystring with str_replace
str_replace($request->url(), '',$request->fullUrl())
Or you can get a array of all the queries with
$request->query()
Request class doesn't offer a method that would return exactly what you need. But you can easily get it by concatenating results of 2 other methods:
echo (Request::getPathInfo() . (Request::getQueryString() ? ('?' . Request::getQueryString()) : '');
Get the current URL including the query string.
echo url()->full();