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 AllLaravel whereDate and whereDay Example
laravel whereDate and whereDay example, whereDate, whereDay, where condition in laravel, laravel date format, wheredate and whereDay in laravel 8
Laravel Many to Many Eloquent Relationship
laravel belongs to many tutorials, many to many sync, many to many attach, save many to many relationship, create many to many relationship Laravel
How to Install Ckeditor in Laravel 9
Laravel 9 ckeditor tutorial example, you will learn how to install or integrate ckeditor and use in laravel 9 app
Generate Laravel PDF with Image Example
In this post, I will demonstrate how to create a Laravel PDF with an image. We occasionally need to generate a PDF with an image for reporting purpose...
How to Use Yajra Datatables in Laravel 9 Application
Learn how to enhance your Laravel 9 application with Yajra Datatables. This tutorial will guide you through the steps of integrating and using it.