ricardoper/slim3-skeleton

Route helper in Controller

faurelia opened this issue · 1 comments

I might have missed it when I searched so I'm sorry but is there an easy way to access routes for redirecting ? Currently, I'm doing this inside the controller method which is kinda long:

$this->getContainer()->get('router')->pathFor('login')

Hello @faurelia ,

Thanks for your question.

At this moment this Skeleton don't have any URL helper, so you need to use the Slim 3 methods.

Yes, it's large, but this is the normal way in Slim 3:
http://www.slimframework.com/docs/v3/objects/router.html#route-names

You mention redirects, so maybe this can help you too:
http://www.slimframework.com/docs/v3/objects/router.html#redirect-helper

If I miss understood the question or you need more help, give me a second chance...

Regards,
Ricardo Pereira.