spyrosjeva's avatar

Confusion with routes

Lets say you having an e-shop and urls goes like this

route::resource('{category}/{product}','Controller')

But at the same time you also having some info pages whe the urls are like this

route::resource('{page},'PageController')

As you can guess in the above routes the one who is first is overriding the second.

How would you do it? What's the best practise here? and how can you go when you want to add more parameters on the game like

route::resource('{para}/something/{para},'Controller')

Thank you!

0 likes
5 replies
rin4ik's avatar

your route implementation is very bad!

Snapey's avatar

You need a way to differentiate between the routes, such as putting all your pages after /page

route::resource('/page/{page}','PageController');
route::resource('{category}/{product}','Controller');
Snapey's avatar

lol. I copied the mistake from the original OP, but then put the apostrophe in the wrong place

vrkansagara's avatar

@spyrosjeva Try to increase a usage of prefix or group or namespace routing. Which definitely reduce your confusion.

2 likes

Please or to participate in this conversation.