Bagisto Forum

    Bagisto

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    How to override or remove the items in menu for admin interface

    Knowledge Base
    4
    9
    1788
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • K
      khanhlp last edited by

      Hello Everyone!

      I want to override or remove the items in menu for admin interface
      1846697b-508a-4e1e-ba0b-517cad06911e-image.png

      As above picture , I want to override or remove item Customers in menu.Please help me.

      Thanks

      1 Reply Last reply Reply Quote 0
      • R
        RK REZA last edited by RK REZA

        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.

        ghermans 1 Reply Last reply Reply Quote 0
        • ghermans
          ghermans @RK REZA last edited by

          @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.

          Kind regards,
          Glenn Hermans

          Manager Bagisto Europe
          info@bagisto.eu

          1 Reply Last reply Reply Quote 0
          • R
            RK REZA last edited by

            @ghermans I know it is not a good idea to work within Webkul's packages. That's why I also included the override method.

            1 Reply Last reply Reply Quote 0
            • K
              khanhlp last edited by

              Thanks @RK-REZA, @ghermans . I try override 'key' in config/menu of my package but it's not working.
              If I override in config/menu without my package, item Customers has been overrode , but this mean I must override all child item of Customer. This is not good.

              1 Reply Last reply Reply Quote 0
              • R
                RK REZA last edited by

                @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.

                K 1 Reply Last reply Reply Quote 0
                • K
                  khanhlp @RK REZA last edited by

                  @RK-REZA I override Customer to Admin. Now, I want to show only an item admin and hidden the item Groups, Reviews, Newsletter Subscriptions
                  8f6ec888-a342-413e-9168-250098492130-image.png
                  My code in config/menu
                  9e113cf5-1dcf-4c8d-ae10-b4c54e9fc57d-image.png

                  1 Reply Last reply Reply Quote 0
                  • P
                    prateek-webkul last edited by

                    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

                    K 1 Reply Last reply Reply Quote 1
                    • K
                      khanhlp @prateek-webkul last edited by

                      @prateek-webkul Great! Thank you very much

                      1 Reply Last reply Reply Quote 0
                      • First post
                        Last post