caffeinated / menus

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

Strange +add issue #11

Closed illuminate3 closed 9 years ago

illuminate3 commented 9 years ago

Here"s part of the menu I'm building.

        $menu->add('HR', 'school');
        $menu->school->add('Employees', 'employees');

This will error out with

Call to a member function add() on a non-object

However this works

        $menu->add('School', 'school');
        $menu->school->add('Employees', 'employees');

I could figure out why this was Happening until I realized that the Route and Link name have to be the same.

Is this a bug?

kaidesu commented 9 years ago

No no, you got it kinda backwards!

Your second example is correct; your first example should be:

$menu->add('HR', 'school');
$menu->hr->add('Employees', 'employees');

It's going off the name of the menu item (in lower case form) - not the route/URL.

illuminate3 commented 9 years ago

Thanks!