How to Get Current URL in Laravel

In this article, we will see how to get the current URL in laravel. if you want to get the current page URL in laravel 8 then we can use many methods such type current(), full(), request(), url(). Here I will give you an example of laravel get current URL. In this example, I have used helper and function.

So, le's see  laravel 8 get current url, get current page url in laravel 8, get full url in laravel 8, find current url in laravel 8, laravel 8 get url path, how to get current url in laravel controller, how to get current url in laravel blade

full() with Helper and Query string parameters

 

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

dd($currenturl);

 

 

current() with Helper

 

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

dd($currenturl);

 

using Request

 

$currenturl = Request::url();

dd($currenturl);

 

 

current() with Facade

 

$currenturl = URL::current();

dd($currenturl);

 

full() with Facade and Query string parameters

 

$currenturl = URL::full();

dd($currenturl);

 

 

Get Previous URL in Laravel :

 

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

dd($pre_url);

 

Get Current Route in Laravel :

 

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

dd($cur_route);

 


You might also like :

techsolutionstuff

Techsolutionstuff | The Complete Guide

I'm a software engineer and the founder of techsolutionstuff.com. Hailing from India, I craft articles, tutorials, tricks, and tips to aid developers. Explore Laravel, PHP, MySQL, jQuery, Bootstrap, Node.js, Vue.js, and AngularJS in our tech stack.

RECOMMENDED POSTS

FEATURE POSTS