If some one find a way to create an array with the registered routes paths within Laravel 4. If someone wants to get a list something like this returned:
/
/login
/join
/password
Solution: For this we will use the method
Route::getRoutes()
which will return a RouteCollection. On each element, you can do a simple.
$route->getPath()
to get path of the current route.
Each protected parameter can be get with a standard getter.
In this Looping works like this:
$routeCollection = Route::getRoutes();
foreach ($routeCollection as $value) {
echo $value->getPath();
}
By this way we can get a list of registered route paths in Laravel.
0 Comment(s)