How to Get Current URL in Laravel?




How to Get Current URL in Laravel?

This tutorial shows you laravel get current url in controller. I would like to share with you laravel get current url in view. This post will give you simple example of get current url in laravel . it's simple example of laravel get current url. Here, Creating a basic example of 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 7