> For the complete documentation index, see [llms.txt](https://queents.gitbook.io/vilt/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://queents.gitbook.io/vilt/managers/menu.md).

# Menu

you can easily add a new item to the menu with the magic class `Menu::class` to add a new Menu you can add it from the provider or you can add it to the resource on the `menus()` method

### Register Menu on Resource

to add new menu item inside your resource just use this method inside your resource class

```php
public function menus(): array
{
    $menus = [
        $this->group => Menu::make(Str::ucfirst($this->table))->lang($this->table . '.sidebar')->icon($this->icon)->route($this->table . '.index')->can('view_any_' . $this->table)
    ];
    return array_merge($menus, $this->menu());
}
```

### Register Menu on Provider

to register menu item globally without resource file you can use your module provider and inside `boot()` method add this method

```php
VILT::registerMenu(Menu::make('Settings')->label('setting.sidebar')->icon('bx bxs-cog')->route('settings')->can(true)->group('Settings')->key('main'));
```

there is 2 key for now `main` for main dashboard menu and `profile` to profile the dropdown
