how to get url segments count in laravel 5? how to get url segments count in laravel 5? laravel laravel

how to get url segments count in laravel 5?


The Request object has a function that returns all segments, place that in a count() to get the number you seek:

$totalSegsCount = count(Request::segments());