buibr/yii2-dynamic-settings

Dynamic setting management with database table.

Installs: 1

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Forks: 0

Type:yii2-extension

v1.0.1 2019-09-13 04:16 UTC

This package is not auto-updated.

Last update: 2024-05-04 04:19:15 UTC


README

Description

Dynamic setting management with database table.

Installation

composer require buibr/yii2-dynamic-settings

yii migrate --migrationPath=vendor/buibr/yii2-dynamic-settings/migrations/

Usage

Extend settings with new clase.

class Crm extends \buibr\yii2settings\Settings
{
    /**
     * Set the group of settings.
     */
    public static function group()
    {
        return "crm";
    }

    /**
     * The default setting for begining on new installation.
     */
    public static function defaults()
    {
        return [
            [
                'name'      =>'default_vat',
                'value'     => 0,  
                'text'      => 'What is the autoselected VAT ',
                'type'      => self::TYPE_SELECT,
                'source'    => self::SOURCE_CLASS,
                'source_data' => '\app\models\VatGroups'
            ],
            [
                'name'      => 'invoicing_date',
                'value'     => 3,  
                'text'      => 'In which day of the month we will generate invoices for clients.',
                'type'      => self::TYPE_TEXT,
            ],
        ];
    }
}

call like:


foreach(Crm::all() as $sett) {
    $sett->render();
}