Replies: 2 comments 4 replies
-
Hello @mxmtsk, Did you find an answer for this? I think it is actually intentional, but a nice way to handle multiple, different menus would be cool. Currently, I would suggest creating one section for each menu and use them after the tree is generated. $navigation = Navigation::make()
->add('menu1', False, function (Section $section) {
$section
->add('Overview', route('account.view'))
->add('Settings', route('account.view'))
->add('Secruity', route('account.view'))
->add('Logs', route('account.view'));
})
->add('menu2', False, function (Section $section) {
$section
->add('Overview', route('account.view'))
->add('Settings', route('account.view'))
->add('Secruity', route('account.view'))
->add('Logs', route('account.view'));
});
var_dump($navigation->tree()['menu1']); # Menu 1
var_dump($navigation->tree()['menu2']); # Menu 2 I would love to add something like this but I am not sure which way is the best. |
Beta Was this translation helpful? Give feedback.
-
So, it seems that the navigation is stored via the make() calls, which creates a service container. I simply tried to remove the I'm not certain why this make() was built in, since it get set in the service provider anyway. So if you remove the make() calls and override the ServiceProvider to not scope the class, it should work. Maybe we should mention it in the docs or remove it from the ServiceProvider entirely, or find a way to define multiple menus in the container. What do you think @freekmurze? I hope I don't interrupt you with the mention. I don't know if it is the right way. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I wanted to create two seperate menus in my application like this basic example:
The issue I face is, that the second menu will have the item of the first menu. Is that an issue or by design or am I simply missing something here.
Beta Was this translation helpful? Give feedback.
All reactions