Reputation: 13537
It's quite easy to get the current URL:
Request::url()
This would return something like:
http://localhost/some/or/other/path
However, if I want an easy way to get only:
some/or/other/path
What would I do? Is there a way to do this without parse_url? I.e. Does Laravel have an inherent built-in way to do this?
Upvotes: 1
Views: 2528
Reputation: 615
An alternative way is to use the controller action parameter $request:
$request->path();
//or global helpers
request()->path();
The functionality is available now (docs) and at least since Laravel 5.2
Upvotes: 0
Reputation: 1087
In my codes I am using code below (Laravel version 4)
Request::url();
Upvotes: 1