Reputation: 6099
I want to be able to get the first path directory from a URL in Laravel 5.1. For example, take a look at the following url:
http://mydomain.co.uk/supervisor/add
From the above url, I want to return /supervisor
Does anyone know how I can achieve this?
Upvotes: 1
Views: 2352
Reputation: 1695
You can use uri segment.
$segment = Request::segment(1);
dd($segment);
Hope it will help.Thanks
Upvotes: 7