In%% 5, I'm creating a menu dynamically by making a Laravel
in the list of registered routes.
So, I can have a menu displayed every time a new route is created, however I'm only listing those that foreach
the contém
method in the controller.
So:
@foreach(Route::getRoutes() as $route)
@if(Str::finish($route->getName(), '.index'))
<li>
{{ link_to_route($route->getName()) }}
</li>
@endif
@endforeach
However, in the second parameter of index
, it would be interesting to pass a title to this route. So I would have links with the very descriptive name for the route, instead of displaying link_to_route
complete.
Is there any way to create a title for this route in the creation of url
(I'm not talking about the Rota
option that is used internally)?
Is there any way to define in the controller method or route an attribute for me to use as the title of "as"
? Can I do this in Route
?