How to override or remove the items in menu for admin interface
-
Hello Everyone!
I want to override or remove the items in menu for admin interface
As above picture , I want to override or remove item Customers in menu.Please help me.
Thanks
-
To remove - Go to Packages/Webkul/Admin/Config/menu.php & remove whatever you want.
To override - You have to override that specific package/module and you can add your own custom menu. -
@RK-REZA said in How to override or remove the items in menu for admin interface:
To remove - Go to Packages/Webkul/Admin/Config/menu.php & remove whatever you want.
I doubt that this is a good method.
For example if you update Bagisto to a new version your changes will get overwritten again, so this means that you have to remove the items each time. -
@ghermans I know it is not a good idea to work within Webkul's packages. That's why I also included the override method.
-
-
@khanhlp Just override the whole Customer package & use your route (index) to change the menu. The route will define which part of the Webkul/Customer package. If you use only the index route the the rest of the package will not be affected by your package.
-
@RK-REZA I override Customer to Admin. Now, I want to show only an item admin and hidden the item Groups, Reviews, Newsletter Subscriptions
My code in config/menu
-
hello @khanhlp,
the way you overrided the menu is not the correct way, and any update will remove your code. You can add below code in your package service provider to remove customer menu from admin interface.
$config = \Config::get('menu.admin'); $getKeys = []; foreach($config as $key => $data) { if (strpos($config[$key]['key'], 'customers') === false) { $getKeys[] = $config[$key]; } }; \Config::set('menu.admin', $demo);
And, can further create menu in admin panel refer (https://devdocs.bagisto.com/create_package.html#add-menu)
Note: With the above code, you can hide the menu but it can be access through route in url.
Thanks
-
@prateek-webkul Great! Thank you very much