Shop › Forums › Laravel Discussion › How to show the list of routes in laravel 7? › Reply To: How to show the list of routes in laravel 7?
May 3, 2021 at 11:28 am
#9243
Participant
Route::getRoutes() returns 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.
Looping works like this:
$routeCollection = Route::getRoutes();
foreach ($routeCollection as $value) {
echo $value->getPath();
}
Also, after the laravel installation of 8, the namespace property in app/Providers/RouteServiceProvider.php is now null