How to get current url with parameters in Laravel 5?

By Hardik Savani | August 8, 2016 | | 7523 Viewer | Category : Laravel


We sometimes require to get full url path with query string parameters that way we can perform on it. So we can get current url with also all parameter using several method of laravel.

There are several option to get full url with query string as listed bellow:

  • URL Facade
  • Request Facade
  • $request Object

I give you three way to get full path with parameters, so you can see as bellow:

Example 1:

public function index()

{

$fullURL = \URL::full();

print_r($fullURL);

}

Example 2:

public function index()

{

$fullURL = \Request::fullUrl();

print_r($fullURL);

}

Example 3:

public function index(Request $request)

{

$fullURL = $request->fullUrl();

print_r($fullURL);

}



Do you want to expert php developer or developer team for your projects ?
Contact US
We are Recommending you: