Laravel Get Current URL With Parameters Example

Laravel get the current URL with parameters, domain, etc. This tutorial show you, how you can get the current URL, previous URL, global url, current URL Path in laravel

How to Get Current Request URL

Us the below give a method for get current URL without the query string

echo \Request::url();

Use global url function

echo url()->url();

Use the current function

echo url()->current();

Get current full URL with query string parameters

echo url()->full();

How to get Current URL path

Use the below method for- get the current path in laravel


Get the previous URL in Laravel

Sometimes we need to check what was the last requested or previous URL, it is simple to do in laravel here is how

echo url()->previous();

If you have any questions or thoughts to share, use the comment form below to reach us.

Leave a Reply

Your email address will not be published. Required fields are marked *