Here we are going to discuss how to add a menu in the admin panel in Bagisto. Just with a few lines of codes, we can add the menu it`s super easy
Now, Let’s Get Started,
Step 1
Inside the given path folder of bagisto, create a file of the name menu.php.
Path – packages/ACME/HelloWorld/Config
create an array of key-value pairs contains with four keys key, name, route, sort, icon-class
key – Unique key for menu icon.
name – Name of menu icon.
route – Route name for your menu icon.
sort – Sort the number on which your menu icon should display.
icon-class – Class for menu icon.
1 2 3 4 5 6 7 8 9 10 11 |
<?php return [ [ 'key' => 'custom-menu', 'name' => 'Hello', 'route' => 'admin.menu.index', 'sort' => 1, 'icon-class' => 'menu-icon', ] ]; |
Step 2
Then register it to the Service Provider file using the mergeConfigFrom(path of the menu-file, menu.admin ) in PackagenameServiceProvider.php
1 2 3 4 5 6 7 8 9 10 11 12 |
/** * Register services. * * @return void */ public function register() { $this->mergeConfigFrom( dirname(__DIR__) . '/Config/menu.php', 'menu.admin' ); } |
Step 3
Then Run a command
1 |
php artisan optimize |
That’s all for adding the menu in Bagisto. Stay tuned for more updates on these types of topics. If you have any issues feel free to raise a ticket at https://bagisto.uvdesk.com/en/