In this tutorial, today we discuss about how to get current URL with parameters in laravel 7(Laravel 7 In Get Current URL With Parameters example). we can get by using URL helper class and also use the facade class and request an object for laravel get URL. so we have given following below various types of examples for how to get the current URL.
Get the current URL without the query string
$currentURL = url()->current(); dd($currentURL);
Get the current URL including the query string
$currentURL = url()->full(); dd($currentURL);
Get the full URL for the previous request
$preURL = url()->previous(); dd($preURL);
Get the current URL Without Query String
$currentURL = $request->url(); dd($currentURL);
Get the current URL With Query String
$currentURL = $request->fullUrl(); dd($currentURL);
Get Only Parameters Using segment
//http://www.example.com/one/two?key=value $currentURL = $request->segment(3); dd($currentURL);
Please follow and like us: