👻
VILT Stack Generator
  • Get Started
    • 👻Overview
    • 💻Environment Setup
    • 🚀Install
  • Generate
    • 🧠Resource
    • 🔥Action
    • 🧩Modal
    • 📈Widget
    • 📏Route
    • 🖥️Views
    • 🔒Roles
  • Resource
    • 🔦Using
    • 🪝Hooks
    • 📤Import & Export
  • Builders
    • 🔡Form
    • 📺Table
    • 📄Page
  • Components
    • 💫Using
    • 🆎Text
    • 🔤Textarea
    • 🔠Rich
    • 🔢Number
    • 📞Tel
    • ✉️Email
    • 🔄Toggle
    • 🖌️Color
    • 📅Date
    • ⌛Time
    • ⏲️DateTime
    • ⚡Select
    • 🔁Repeater
    • 📑Schema
    • ✨Section
    • 🖼️Media
    • 💟HasOne
    • 🎁Relation
  • Managers
    • 🔤Translation
    • 📖Menu
    • ♠️Share
  • Helpers
    • ⚠️Alert
    • 💻Render
    • 🌠Actions
    • 🌟Modal
  • Plugins
    • 🔤Translations
    • 📀Settings
    • 📖Menus
    • 🔔Notifications
    • 💳Payment
    • 🏗️Build Plugins
  • Learning
    • 🙏Task To Get Start
    • 🚨CI/CD
    • 🦄Awesome TailwindCSS
Powered by GitBook
On this page
  • Register Menu on Resource
  • Register Menu on Provider
  1. Managers

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

PreviousTranslationNextShare

Last updated 2 years ago

📖