In this little post, we will perceive how to get the current URL in Laravel, assuming you need to get the current page URL in Laravel, we can utilize numerous methods such as sort current(), full(), request(), URL().
Here I will give you all guide to get the current page URL in Laravel, in this model I have utilized aid and capacity just as so we should begin illustration of in what manner to get the current URL id in Laravel.

Example 1: full() with the Helper and Query string parameters 

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

Example 2: current() with the Helper

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

Example 3: using the Request

$currenturl = Request::url();
dd($currenturl);

Example 4: current() with the Fa?ade

$currenturl = URL::current();
dd($currenturl);

Example 5: full() with the Facade & Query string parameters.

$currenturl = URL::full();
dd($currenturl);

Get the Previous URL in Laravel

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

Get Current Route in Laravel

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

I hope you will like the content and it will help you to learn How to Get Current URL in Laravel
If you like this content, do share.


Recommended Posts

View All

Laravel 9 ConsoleTvs Charts Tutorial Example


consoletvs/charts laravel 9 ,consoletvs charts laravel 9 ,laravel 9 chart consoletvs ,consoletvs/charts laravel 9 tutorial ,laravel charts,laravel ch...

Laravel 9 Scout Full Text Search with Algolia Tutorial


A full-text search feature in a web application is incredibly useful for users to navigate through content-rich web and mobile applications, as demons...

Laravel 8 Generate PDF File using DomPDF | Laravel 8 PDF


How to generate pdf from view, html, blade in laravel 8. Here, we would share with you how to generate pdf file from blade view in laravel 8

Google Map with Multiple Marker and Info Box in Laravel


This tutorial will teach you how to use Laravel to integrate a Google Map with numerous markers and an info box.

Laravel 9 Livewire Form Submit Tutorial


Laravel 9 Work With Livewire Form Submit Tutorial. laravel 9 livewire form submit example, create form with laravel 9 livewire, laravel 9 livewire tut...