# 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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://queents.gitbook.io/vilt/managers/menu.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
