Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: outl1ne/nova-menu-builder
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 1.1.2
Choose a base ref
...
head repository: outl1ne/nova-menu-builder
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 1.1.3
Choose a head ref
  • 2 commits
  • 2 files changed
  • 1 contributor

Commits on May 8, 2019

  1. Document nova_get_menu

    Tarpsvo committed May 8, 2019

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    d1eb217 View commit details
  2. Copy the full SHA
    d77674c View commit details
Showing with 7 additions and 0 deletions.
  1. +6 −0 README.md
  2. +1 −0 src/Models/Menu.php
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -147,6 +147,8 @@ public static function getValue(string $value, array $parameters = null)

### Returning the menus in a JSON API

#### nova_get_menus()

A helper function `nova_get_menus` is globally registered in this package which returns all the menus including their menu items in an API friendly format.

```php
@@ -156,6 +158,10 @@ public function getMenus(Request $request) {
}
```

#### nova_get_menu(\$menuSlug)

To get a single menu, you can use the helper function `nova_get_menu('slug')`. Returns null if no menu with the slug is found or returns the menu if it is found.

### Menu locale options

To define locales that you can select for your menus, please register them in the constructor of `MenuBuilder` in `NovaServiceProvider`'s `tools()` function:
1 change: 1 addition & 0 deletions src/Models/Menu.php
Original file line number Diff line number Diff line change
@@ -34,6 +34,7 @@ public function formatMenuItem($menuItem)
{
return [
'id' => $menuItem->id,
'name' => $menuItem->name,
'type' => $menuItem->type,
'value' => $menuItem->customValue,
'target' => $menuItem->target,