// Full URL with query string
print $request->fullUrl(); // http://127.0.0.1:8000/sometext?city=hyd
// Get the path part of the URL
print $request->path(); // sometext
// Root (protocol and domain) part of the URL)
print $request->root(); //http://127.0.0.1:8000
//Get the full URL for the previous request
print url()->previous();
//tested on Laravel 5.6
//OR
use IlluminateSupportFacadesURL;
print URL::current();
Get the current url
here using the Request::url() method. It will return the entire URL, but strip the query string from it.
<p> Url: {{ Request::url() }} </p>
Output
Url: http://localhost:8000/post/demo