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