Module

Definition

A module can be a simple CRUD tool for managing data in a database, or an advanced tool for performing complex tasks, such as a Workflow Manager for example.

Uccello helps you to manage data from a database without programming. When you create a new module all the views, routes and controllers are automatically available and the UI is scaffolded by itself.

It is possible to activate or deactivate a module in some domains.

Examples

Classic module

<?php

use Uccello\Core\Models\Module;

Module::create([
    'name' => 'person',
    'icon' => 'person',
    'model_class' => 'App\Person',
    'data' => null
]);

This module named person allows to manage people from the database. This name will be translated according to the module's translation file. It is represented by the material icon called person. It is linked to the App\Person model and can access automatically to the related database table.

Admin module

<?php

use Uccello\Core\Models\Module;

Module::create([
    'name' => 'country',
    'icon' => 'terrain',
    'model_class' => 'Uccello\Address\Models\Country',
    'data' => [ "package" => "uccello/address", "admin" => true ];
]);

This is the code of the module called country , available in the uccello/address package. As this module is part of an external package we must specify the name of the package. We can do this with "package" => "uccello/address". In the same way, we link it to the Uccello\Address\Models\Country, also available in this package. As we use "admin" => true, this module is only visible in the Settings Panel by user who can administrate this module.

Common properties

Here is the list of properties common to all modules. You can specify this properties into the data attribute of the module.

You can use the data attribute to add specific properties to your module.

Attribute

Type

Description

Default

admin

bool

If true, the module is only visible in the Settings Panel, by users who are admin or who have admin capability on this module.

false

mandatory

bool

If true, this cannot be deactivated from the Module Manager page.

false

menu

string, bool, array

  • If the value is a string, this attribute is the name of the route to use, eg uccello.list and the translated module's name will be used as link. You can go to the Routes page to see all the default routes you can use.

  • If the value is a false, no link is added to the menu to access this module.

  • If the value is an array, all defined links are added to the menu. Link structure : - label : Link label. This label will be translated. - route : Route name. - icon : Material icon to use. If null, the module's icon is used by default. Example: [ [ "label" => "menu.settings", "route" => "settings.index", "icon" => "settings_applications" ], [ "label" => "person", "route" => "uccello.list" ],

    ]

package

string

Name of the external package in which the module is located.

This attribute is only useful for making sharable modules, installable with composer.

null

Last updated

Was this helpful?