How to get current url with parameters in Laravel 5?

By Hardik Savani | August 8, 2016 | | 47417 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);

}




Hardik Savani
My name is Hardik Savani. I'm a full-stack developer, entrepreneur and owner of Aatman Infotech. I live in India and I love to write tutorials and tips that can help to other artisan. I am a big fan of PHP, Javascript, JQuery, Laravel, Codeigniter, VueJS, AngularJS and Bootstrap from the early stage.
Follow Me: Github Twitter
***Do you want me hire for your Project Work? Then Contact US.

We are Recommending you: