You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The package will automatically register its service provider.
29
29
30
-
<!-- omit in toc -->
31
-
## Usage
32
-
Menus Manager has many features to help you working with dynamic menus
33
-
34
-
-[Create Menu](#create-menu)
35
-
-[Menu hierarchy](#menu-hierarchy)
36
-
-[Menu Item](#menu-item)
37
-
-[Item Types](#item-types)
38
-
-[Route item](#route-item)
39
-
-[Url item](#url-item)
40
-
-[Divider item](#divider-item)
41
-
-[Header item](#header-item)
42
-
-[Item Icon](#item-icon)
43
-
-[Item Order](#item-order)
44
-
-[Item Visibility](#item-visibility)
45
-
-[Active state](#active-state)
46
-
-[Search for item](#search-for-item)
47
-
-[Menu Tree](#menu-tree)
48
-
-[Blade components](#blade-components)
49
-
50
-
### Create Menu
51
-
Use the provided `Menus` facade with `register` method to create a new menu.
52
-
_**notice:** if menu with given name already exists it will be returned - this way you can access to any existing menu anywhere in your application_
53
-
```php
54
-
// Create new "main" Menu
55
-
$menu = Menus::register('main');
56
-
```
57
-
58
-
You can now access to the menu any time using:
59
-
```php
60
-
// Retreive "main" Menu
61
-
$menu = Menus::get('main');
62
-
```
63
-
64
-
And get all items for the Menu
65
-
```php
66
-
// Get all items from Menu
67
-
$items = $menu->items();
68
-
```
69
-
You can get a specific item by using search methods. See [Search for item](#search-for-item).
70
-
71
-
### Menu hierarchy
72
-
Menus Manager lets you create multi-level menus. Each Menu item can have as many children as you want. See [Menu Item](#menu-item) to find out how to create a new Menu Item.
73
-
74
-
You can easily retreive declared children using:
75
-
```php
76
-
// Check if item has children
77
-
if ($menuItem->hasChildren()) {
78
-
// Get all item children as Collection
79
-
$items = $menuItem->children();
80
-
81
-
// Loop into items
82
-
foreach($items as $item) {
83
-
// Get item parent
84
-
$parent = $item->parent();
85
-
86
-
// ...
87
-
}
88
-
}
89
-
```
90
-
91
-
### Menu Item
92
-
An item can be added at any level: the menu itself or any child item.
Menus Manager provides blade components to ease integration in your designs.
293
-
294
-
You just have to pass your Menu name to get full render.
295
-
```php
296
-
<x-menus-menuname="main" />
297
-
```
298
-
It uses `x-menus-children`, `x-menus-divider`, `x-menus-header`, `x-menus-icon` and `x-menus-item` dedicated components. By default Menus Manager will scaffold your application's integration with the [Tailwind CSS](https://tailwindcss.com/) and [Alpine.js](https://github.com/alpinejs/alpine).
299
-
300
-
You can customize component's views to fit to your need by publishing them into your application resources:
0 commit comments