caffeinated / menus

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

Show children only #23

Closed xtrasmal closed 9 years ago

xtrasmal commented 9 years ago

I've got a menu at the top of the site and want the children to be show on a sidebar. Is it possible to show the children only?

kaidesu commented 9 years ago

Yup~

There's two methods you can call on a menu item; hasChildren() which will return a bool based on if it has children items or not, and children() which will return an array of all children items that you'll be able to loop through as needed. You can see these methods in use on the wiki here.

You should be able to build a partial to loop through children item within your sidebar.

xtrasmal commented 9 years ago

How do I create a menu that has

kaidesu commented 9 years ago

The answer I provided in your other issue https://github.com/caffeinated/menus/issues/20#issuecomment-96081012 answers those two questions.

xtrasmal commented 9 years ago

Thank you very much. I got it working.