Laravel - How to get current url in laravel controller and view

Most of the times when we develop a project, we need a current URL of application like for ajax pagination, to reload current page, redirection purpose and other places in project.

You can easily get current url in laravel 5, laravel 6, laravel 7 and laravel 8 application.

To get current URL laravel provides url helper. With the help of this url helper we can get information about the current URL.

To get current URL

echo url()->current();


To get current URL with query string

echo url()->full();


To get URL of previous request URL

echo url()->previous();


To get current URL in view blade file

{{ url()->current() }}


All of the above methods can be accessed via URL facade. Check below example

use IlluminateSupportFacadesURL;
echo URL::current();

Created At: 16 January, 2021

Views: 104



Social Sharing
Search