How To Get Current URL With Parameters Laravel 8

In this tutorial, today we discuss how to get current URL in laravel 8. we can using the URL generator the URL helper class and also use the facade class and request for laravel 8 get the URL. 

This discusses how to get current URL with parameters in laravel 8 echo definition. so how to get URL in PHP. We will learn how to get a URL in an easy way in the Laravel Framework.

How To Get Current Url In Laravel 8 ? | How To Get Url In PHP

Get the current URL without the query string

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

Get the current URL including the query string

$currentURL = url()->full();

Get the full URL for the previous request

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

Get the current URL Without Query String

$currentURL = $request->url();

Get the current URL With Query String

$currentURL = $request->fullUrl();

Get Only Parameters Using segment
$currentURL = $request->segment(3);

I hope it can help you...

Leave a Reply

Your privacy will not be published. Required fields are marked *

We'll share your Website Only Trusted.!!