📖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

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

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

Last updated