In this example, we wil see how to get current url with parameters in laravel 8. We will see example to get current url with parameters in laravel 8.

I will give you few examples to get full path with parameters, as listed below:



Example 1:

public function index()
{
  $currentURL = \URL::current();
  dd($currentURL);
}



Example 2:

public function index()
{
  $fullUrl = \URL::full();
  dd($fullUrl);
}



Example 3:

public function index()
{
  $previousURL = \URL::previous();
  dd($previousURL);
}



Example 4:

public function index()
{
  $currentURL = \Request::url();
  dd($currentURL);
}



Example 5:

public function index()
{
  $fullUrl = \Request::fullUrl();
  dd($fullUrl);
}



Example 6:

public function index()
{
  $currentURL = \Request::segment(1);
  dd($currentURL);
}



Example 7:

public function index(Request $request)
{
  $currentURL = $request->url();
  dd($currentURL);
}



Example 8:

public function index(Request $request)
{
  $fullUrl = $request->fullUrl();
  dd($fullUrl);
}



Example 9:

public function index(Request $request)
{
  $currentURL = $request->segment(1);
  dd($currentURL);
}



I hope this example helps you.