Sorting subitems
Vinze opened this issue · 0 comments
Vinze commented
Would it be possible to only sort the subitems? See the example below, I'd like to only sort the children of the settings menu item.
Menu::make('mainmenu', function($menu) {
$menu->add('Dashboard', 'dashboard');
$menu->add('My account', 'account');
$menu->add('Settings', 'settings');
if (Gate::allows('administrator')) {
$menu->settings->add('Users', 'users');
// ...
}
if (Gate::allows('finance')) {
$menu->settings->add('Pricelists', 'pricelists');
// ...
}
// This doesn't work:
$menu->settings->children()->sortBy('title');
});