Another option, if you have the "Request $request" object (which you probably do if you used dependency injection in the controller), then you can just do this:
$request->url()
Note that that's the URL without any query (GET) variables. These are also useful depending on what you want:
// Full URL, with query string
$request->fullUrl()
// Just the path part of the URL
$request->path()
// Just the root (protocol and domain) part of the URL)
$request->root()
Those methods also work from the "Request::" facade.
Guys, is there available another methods on function url()? Or just current()? It's because I need to get almost full URL, but without ending {slug} and I don't know how.
I am not aware of where do you want to get current path at server side or client side. here I am giving you both ways to get current url in laravel application.
Server side
use Illuminate\Support\Facades\URL;
echo URL::current();
Client side
You can use url() helper in laravel blade url()->current()
Client side in Javascript
document.URL;
I hope reply will be helpful you. It is quite late. but it will help to new comers.