router
router copied to clipboard
How to get the route from controller/action ?
I want to output a menu and get the links automatically from the router.
<a href="/">Home</a>
<a href="/contact_us">Contact Us</a>
But I don't want to write the url in the html manually.
If I set this:
$router->get('/', 'Controller@home');
$router->get('/contact_us', 'Controller@contact');
How can I get / back from Controller class, index method?
How can I get /contact_us back from Controller class, contact method?
I'm working on a PR rn, so you can call other routes except 404. Your feature would be possible after hat merge, but it would need much more unnecessary performance every time you need a link. I recommend you to simply just write /contactus or something. These links should be static anyway