buibr / yii2-dynamic-settings
Dynamic setting management with database table.
v1.0.1
2019-09-13 04:16 UTC
Requires
- php: ^7.0
- yiisoft/yii2: ^2.0
This package is not auto-updated.
Last update: 2025-03-08 08:14:38 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();
}