Home Laravel How to Get Current URL with Parameters in Laravel?

How to Get Current URL with Parameters in Laravel?

by Shahriar Sagor

Today now in this post i will show you How to Get Current URL with Parameters in Laravel? sometimes we may need to get the full url path also with query string parameters on that way we can easily perform on it. So we can get the current url with also all the parameter by using several method of laravel 6, laravel 7 and laravel 8 any version.

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

  • URL Facade
  • Request Facade
  • $request Object

I will give you here three way to get the full path with parameters, so we 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);
}

Read Also : Laravel 8 Mobile Number Verification Tutorial

Thanks for read. I hope it help you. For more you can follow us on facebook

close

You may also like