I have a problem in laravel to get the name of the route not current. Looking in the documentation I found this function currentRouteName()
however this works only for the route that is running at that moment.
Although the question is not very clear, I think that all the possible routes are what you want. To do this you can use the Route::getRoutes()
function that returns a list with all the routes.
$routeCollection = Route::getRoutes();
Now you have them all in routeCollection
and if you want to iterate through them:
foreach ($routeCollection as $value) {
echo $value->getPath();
}
So the whole code would be:
$routeCollection = Route::getRoutes();
foreach ($routeCollection as $value) {
echo $value->getPath();
}