lavary/laravel-menu

Active Restful Routes

Closed this issue · 4 comments

I'm seeing an issue with active restful routes.

domain.test/brands/create
domain.test/brands/1/edit
domain.test/brands

When visiting create or edit the index route is also set to active.

Am I missing something?

Check out the documentation.

https://github.com/lavary/laravel-menu#active-item

You might need to exclude the index route, or manually activate routes.

Thanks @dustingraham.
I was hoping to not have to do things manually.

The situation around this is a dropdown that should be active/open if the current url is a resource route and the items under it are 'a create route' and an 'index route'. Using the examples in the docs including a blade partial inside itself to create submenus, I can't wrap my head around the best way to do that and set the dropdown items to active if it is only that specific route, instead of applying a general resource to all of them. i.e. if i'm on the index route then it is the only one in the submenu that is active, but if i'm on the create route then the index is also set to active. Is something off or am I just not understanding it correctly?

Instead of using a restful route, what about using a normal route, with pattern matching for the sub-items. I think the entire point of the restful route is to activate the index route when any of the other routes are active.

i'll give it a go.

Thank you for you insight.

I'll go ahead and close the issue since, it's more than likely not a bug. :)