How to Get Current URL with Parameters in Laravel?

How to Get Current URL with Parameters in Laravel?

In this post we will give you information about How to Get Current URL with Parameters in Laravel?. Hear we will give you detail about How to Get Current URL with Parameters in Laravel?And how to use it also give you demo for it if it is necessary.

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:

Also see:How to Get Current Controller Name in View Laravel?

public function index(Request $request)

{

$fullURL = $request->fullUrl();

print_r($fullURL);

}

Hope this code and post will helped you for implement How to Get Current URL with Parameters in Laravel?. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve us. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs

For More Info See :: laravel And github

Leave a Comment

Your email address will not be published. Required fields are marked *

85  +    =  95

We're accepting well-written guest posts and this is a great opportunity to collaborate : Contact US