php - Laravel get uri from route name
I??�m using Laravel??�s routing component outside of Laravel so I don??�t have the route() helper function, or any other helper method like app(). Can I still make use of route names? If so how can I get the route uri from a name?
Answer
Solution:
I was able to loop through the route collection and match from name.
foreach($router->getRoutes() as $route) {
if($route->action['as'] === $name) {
return $route->uri;
}
}
Source