I've tried to find the full path of current route in Laravel 5.x
For this case i've created a method with the following code, but i can't imagine that Laravel
does not provide something like this themselves:
$current = Route::getFacadeRoot()->current();
$uri = $current->uri();
foreach ($current->parameters() as $key => $param) {
$uri = str_replace('{' . $key . '}', $param, $uri);
}
return url($uri);
Is there something out of the box in Laravel
that i just can't find?
you can use
Request::url()
blade:
{{\Request::url()}} // if is in blade
Try this clause:
URL::current();
Or:
$request->url();
Or PHP way:
$_SERVER['REQUEST_URI'];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With