How to Get Current Full URL in Laravel 9?

Today, I would like to show you laravel 9 get current url in controller. This post will give you simple example of laravel 9 get current url in view. you will learn get current url in laravel 9. step by step explain laravel 9 get current url.

Laravel provide URL facade that way we can get current URL anywhere, as bellow you can see i use current() of URL facade. URL facade through you can get your current page url from every where. So you can check your current url this way:

Get Current URL in Laravel:

Example 1: current() with Helper

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


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

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


Example 3: current() with Facade

$currentURL = URL::current();


Example 4: full() with Facade(with query string parameters).medrectangle-4-multi-155{border:none!important;display:block!important;float:none;line-height:0;margin-bottom:15px!important;margin-left:0!important;margin-right:0!important;margin-top:15px!important;max-width:100%!important;min-height:250px;min-width:300px;padding:0;text-align:center!important}

$currentURL = URL::full();


Example 5: using Request

$currentURL = Request::url();


Get Previous URL in Laravel:

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


Get Current Route in Laravel:

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


I hope it can help you….

Leave a Comment