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();

Example 2: current() with the Helper

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

Example 3: using the Request

$currenturl = Request::url();

Example 4: current() with the Fa?ade

$currenturl = URL::current();

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

$currenturl = URL::full();

Get the Previous URL in Laravel

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

Get Current Route in Laravel

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

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

Helper Function Example in Laravel 8

helper function example in laravel 8, laravel 8 global helper function, how to use global helper function in laravel 8, add helper function in laravel

Laravel 9 Database Backup with Spatie Tutorial Example

Learn how to easily backup your Laravel 9 database using the Spatie backup package with this step-by-step tutorial example. Safeguard your important d...

Laravel One to One Eloquent Relationship Tutorial

Laravel One To One Eloquent Relationships Tutorial Example, Laravel Eloquent ORM is the best possible database solution, ORM Mapping is very easy, lar...

How to install Adminer in Laravel application

In this article we will install Adminer in Laravel 8 application

Laravel Eloquent Query - Laravel whereKey method

We'll look at the whereKey method in Laravel Eloquent in this post. whereKey is an extremely easy-to-use tool with a lot of potential.