get current url laravel – How to get current URL in controller or view?

get current url laravel using url()->current(), url()->full(), URL::current(), URL::full(), Request::url() and url()->previous() Best Examples.

get current url laravel

You can get current url in laravel using following methods.

Get Current URL in Laravel:

Example 1: current() with Helper

$exampleTestURI = url()->current();

Example 2: full() with Helper(with query string parameters)

$exampleTestURI = url()->full();

Example 3: current() with Facade

$exampleTestURI = URL::current();

Example 4: full() with Facade(with query string parameters)

$exampleTestURI = URL::full();

Example 5: using Request

$exampleTestURI = Request::url();

Don’t Miss : laravel get current url

Get Previous URL in Laravel:

$results = url()->previous();

Get Current Route in Laravel:

$results = Route::current()->getName();

I hope you get an idea about get current url laravel.
I would like to have feedback on my blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Leave a Comment