Enable/Disable a module or package in Bagisto.

Updated 19 August 2022

Suppose we have developed a custom module or package for Bagisto then we should have an option to Enable/Disable it’s functionality from admin panel anytime whenever we need it.

Let’s discuss it with an example:

Suppose we have a package named Whats App for placing an order, now using a Whats App button we are performing action for placing an order.

In your package’s source directory i.e. packages/ACME/WhatsAppNotifications/src, create the Config folder and create a file named system.php and create options as shown below.

Now register your config into your package provider.

Here we have also loaded the translation files and views into provider. Now under registerConfig() method we have merged our config file

Also add all the translations into translation files.

Run this command i.e. php artisan optimize 

Now, It will display in admin panel.

Now after clicking on WhatsApp Setting menu link you will redirect to configuration page.

Finally Just by adding a condition over the button we can check status of our module.

So by this way, you can Enable/Disable module functionality and control it from admin panel.

I’ve explored this while contributing to Laravel based project Bagisto, there are a lot more things to learn and you could also contribute to an open source E-Commerce framework.

Thanks for reading me. I hope you’ll get an idea how create an option to Enable/Disable a module in Bagisto.

 

. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


Be the first to comment.

Start a Project


    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home