Site Menus - Facade
The Facade for Site Menus is automatically discovered by Laravel.
Get Menu
A Menu can be retrieved using the facade by calling SiteMenu::get('site-menu-slug').
This will return a collection of array items, each of which should have a label, url and target property.
If the menu does not exist, an empty collection will be returend.
This information is cached upon retrieval. The cache is cleared when updating a menu through the CMS.
Checking if a Menu has items
You can check if a menu has any items in order to decide whether to display it.
To do so, use SiteMenu::hasItems('site-menu-slug').
If a menu is empty or does not exist, the result will be false. Otherwise, true will be returned.
Checking if a Menu should be a burger
You can check to see if a Menu should be created directly as items in a navigation, or as a burger menu.
To do this, use SiteMenu::asBurgerMenu('site-menu-slug').
This distinction is made by testing if the menu has more items than it's max_visible_items attribute.