Sample Module

Information

The Sample Module is aimed at letting the developers learn the proper structure of the addon module in EasyDCIM which will ensure that the module is installed and functions correctly. With the use of the module, EasyDCIM can be customized according to your needs, adding for example custom actions which will be fired during the appropriate system events. (Events). Following the documentation:

EasyDCIM models fire several events, allowing you to hook into various points in the model’s lifecycle using the following methods: saving, saved, updating, updated, deleting, deleted. Whenever a new item is saved for the first time, the creating and created events will fire. If an item is not new and the save method is called, the updating / updated events will fire. In both cases, the saving / saved events will fire.

For instance, you can add the functionality to send an email/SMS each time a device is created/removed. You can also define appropriate reactions to the device start/restart/shutdown by adding additional control commands or notifications.

Download

An example module may be downloaded from this location: Sample Module

Installation

Unzip all files to /opt/easydcim directory.

1.png

Activation

To activate the module in the system go to the Modules -> My Modules section and activate appropriate module:

2.png

Providers

Service provider is the most important file within module. It’s like a bootstrap where module starts its work.


namespace Modules\Addons\CustomModule;

use Components\Core\Support\Providers\ModuleServiceProvider;

/**
 * Class CustomModuleProvider
 * @package Modules\Addons\CustomModule
 */
class CustomModuleProvider extends ModuleServiceProvider
{
    /**
     * @return void
     */
    public function boot()
    {
        parent::boot('CustomModule');
    }

    /**
     * @return void
     */
    public function register()
    {
        parent::register('CustomModule');
    }
}