In this tutorial you will learn about the Laravel Get Current URL With Parameters and its application with practical example.
In this get the current URL with parameters tutorial I will show you how to get the current URL , parameters, domain etc details from current url in laravel. In this tutorial you will learn how can you get the current URL with parameters, previous URL, global URL, current URL Path in laravel.
Laravel Get Current URL With Parameters
How to Get Current Request URL
In the following example we have fetched the current url:
1 |
echo \Request::url(); |
Use global url function
In the following example we have fetched the current url using global url function.
1 |
echo url()->url(); |
In the following example we have fetched the current url using current function.
1 |
echo url()->current(); |
In the following example we have fetched the current url using current full URL with query string parameters
1 |
echo url()->full(); |
How to get Current URL path
In the following example we have fetched the current url path.
1 |
$request->path() |
Get the previous URL in Laravel
In the following example we have fetched the previous url.
1 |
echo url()->previous(); |