caffeinated / menus

:pushpin: Menu generator package for the Laravel framework
https://caffeinatedpackages.com
132 stars 59 forks source link

Menu sub-items error #78

Closed yajra closed 8 years ago

yajra commented 8 years ago

It seems like using the latest version (v2.2.1) breaks the menu sub-items where parent menu uses two words or more like below:

Menu::make('example', function($menu) {
    $menu->add('My Menu', '/espresso');
    $menu->myMenu->add('Americano', '/espresso/americano');
    $menu->myMenu->add('Breve', '/espresso/breve');
    $menu->myMenu->add('Cappuccino', '/espresso/cappuccino');
    $menu->myMenu->add('Latte', '/espresso/latte');
});
yajra commented 8 years ago

Work around atm, is to bind the parent menu to a variable. Or maybe a better approach than what I am used to be doing.

Menu::make('example', function($menu) {
    $myMenu = $menu->add('My Menu', '/espresso');
    $myMenu->add('Americano', '/espresso/americano');
    $myMenu->add('Breve', '/espresso/breve');
    $myMenu->add('Cappuccino', '/espresso/cappuccino');
    $myMenu->add('Latte', '/espresso/latte');
});

Have updated my menu like this. Up to you if you want to fix this. Just note that it breaks on my installation and maybe others too. ^_^. Thanks!

kaidesu commented 8 years ago

D'oh, silly me - I know what's wrong - I'll have this patched in a couple minutes.

kaidesu commented 8 years ago

Give v2.2.2 a go.

Slugs will be properly camel cased, e.g. "My Menu" will become "myMenu".

yajra commented 8 years ago

Works great! Thanks a lot!