Laravel Get Current URL Code Example

Jul 25, 2022 . Admin

I am going to show you example of laravel get current url in controller. This article goes in detailed on laravel get current url in view. if you want to see example of get current url in laravel then you are a right place. you will learn laravel get current url. you will do the following things for get current page url in laravel.

Here is few examples you may use to get current route and url data. The methods will automatically use the schemes(http or https) from url.

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)
$currentURL = URL::full();
Example 5: using Request
$currentURL = Request::url();

It will help you...

#Laravel 9 #Laravel 8 #Laravel