You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

71 lines
1.4 KiB

<?php
/**
* Created by Error202
* Date: 04.06.2018
*/
namespace core\entities;
/**
* @property integer $id
* @property string $type
* @property string $section
* @property string $key
* @property string $value
* @property integer $active
* @property integer $created_at
* @property integer $updated_at
*/
use Yii;
use yii\db\ActiveRecord;
use yii\behaviors\TimestampBehavior;
class Settings extends ActiveRecord
{
public static function tableName(): string
{
return '{{%settings}}';
}
public function attributeLabels()
{
return [
'id' => Yii::t('main', 'ID'),
'type' => Yii::t('main', 'Type'),
'section' => Yii::t('main', 'Section'),
'key' => Yii::t('main', 'Key'),
'value' => Yii::t('main', 'Value'),
'active' => Yii::t('main', 'Active'),
'created_at' => Yii::t('main', 'Created At'),
'updated_at' => Yii::t('main', 'Updated At'),
];
}
public static function create($type, $section, $key, $value, $active): self
{
$settings = new static();
$settings->type = $type;
$settings->section = $section;
$settings->key = $key;
$settings->value = $value;
$settings->active = $active;
return $settings;
}
public function edit($type, $section, $key, $value, $active): void
{
$this->type = $type;
$this->section = $section;
$this->key = $key;
$this->value = $value;
$this->active = $active;
}
public function behaviors(): array
{
return [
TimestampBehavior::class,
];
}
}