Closed illuminate3 closed 9 years ago
Simply call sortBy
every time you modify or add on to your menus so the items get re-ordered properly.
I thought that would be on the main Menu:make. Should I be adding that after the ->data(order)?
You only need to call it once, per menu modification:
Initial Menu Creation:
Menu::make('navbar', function($menu) {
...
})->sortBy('order');
Module's Menu Modification:
$menu = Menu::get('navbar');
$menu->add('Profiles', 'profiles')->data('order', 0);
$menu->sortBy('order'); // Will re-order all menu items for the 'navbar' menu
Thanks!
Well, probably not that much of and edge issue if combined with your module package.
In my main MenuServiceProvider I have:
Then in a module I have:
This works for multiple modules.
However the issue I'm having is with trying to get a module menu to over ride the module ordering ... I haven't checked but I'm guess is that the module order is what sets the default for the menus.
I tried: in my main MenuServiceProvider:
Then in the module menu provider:
But another module that has a higher order rank is still being placed first.
I probably just send all this to a db table and create them there but I'm still working on understanding.