How to use URL Facade in Laravel

Categorized as Laravel

Laravel quick tip! URL Facade is a cool feature in Laravel that allows you to extract the current, previous, and full URLs on any given web page. See the example below:

use Illuminate\Support\Facades\URL;

// This one will give us the current url but will not include any query params:


// This one gives us the query parameters


// This one gives the previous url that we visited.
// For example, I visited 
// before visiting


Leave a reply

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