1. Home
  2. Docs
  3. UltimatePOS
  4. Module Development
  5. Developing Modules

Developing Modules

UltimatePOS uses the Laravel-Module package for module development. So all the commands provided by this package will be used for the development.

Creating Module:

To create a module follow the commands as given in here

Let us assume you created a Modules called: Superhero

Config file:

Inside the new Modules which you created open the config file.


Add 2 configs here:

  • name
  • module_version

So it will be:

return [
‘name’ => ‘Superhero’,
‘module_version’ => “1.0”

Data Controller:

  1. Create a controller with the name “DataController”.
  2. DataController acts as the main controller for interacting with the POS.
  3. It helps many different purposes as described in the further section.

Adding New permission related to modules:

  1. Add function user_permissions() in the DataController which return multi-dimensional array containing arrays of all module permissions with key “value”, “label”, “default”
    where value (string) is the name of the permission, label (string) is the label for the permission, and default (boolean) is the default checked or unchecked state of the permission on the rule add screen
    Example:[ [ 'value' => 'superhero.create', 'label' => __('superhero::lang.add'), 'default' => false ], [ 'value' => 'superhero.update', 'label' => __('superhero::lang.edit'), 'default' => false ] ];
  2. Add migrations to create the permissions in the module

Adding menu from modules:

  1. Create a function modifyAdminMenu in DataController which returns the menu in this format:
    Copy to Clipboard
  2. Add “AdminSidebarMenu” middleware in routes.

Adding New taxonomy or category modules:

  1. Define a function addTaxonomies() in the DataController which returns an array in this format:
Copy to Clipboard

2. Add the taxonomy to menu with url parameter taxonomy type as type, example:

Copy to Clipboard

Parsing notifications related to modules:

  1. Define a function parse_notification($notification) in the DataController which has a notification instance as an argument
  2. Check the type of notification and return the formated notification data as an array. For example:
    Copy to Clipboard

NOTE: To display a notification you should save the notification in the database using toDatabase() method in the Notification class

Was this article helpful to you? Yes 6 No 2