| Current Path : /var/www/html/aipa/backend/models/frontendtheme/ |
| Current File : /var/www/html/aipa/backend/models/frontendtheme/FrontendTheme.php |
<?php
namespace backend\models\frontendtheme;
use backend\models\frontendfooter\FrontendFooter;
use backend\models\frontendheader\FrontendHeader;
use Yii;
/**
* This is the model class for table "frontend_theme".
*
* @property int $theme_id
* @property string $title
* @property string $description
* @property int $header_id
* @property int $footer_id
* @property string|null $theme_setup
* @property string|null $theme_css
* @property string|null $theme_js
* @property string|null $created_at
* @property string|null $updated_at
*/
class FrontendTheme extends \yii\db\ActiveRecord {
public $header_description, $footer_description;
/**
* {@inheritdoc}
*/
public static function tableName() {
return 'frontend_theme';
}
/**
* {@inheritdoc}
*/
public function rules() {
return [
[['title'], 'required'],
[['header_id', 'footer_id'], 'integer'],
[['theme_setup', 'theme_css', 'theme_js'], 'string'],
[['created_at', 'updated_at'], 'safe'],
[['title'], 'string', 'max' => 250],
[['description'], 'string', 'max' => 2500],
];
}
/**
* {@inheritdoc}
*/
public function attributeLabels() {
return [
'theme_id' => Yii::t('app', 'Theme ID'),
'title' => Yii::t('app', 'Title'),
'description' => Yii::t('app', 'Description'),
'header_id' => Yii::t('app', 'Header'),
'footer_id' => Yii::t('app', 'Footer'),
'theme_setup' => Yii::t('app', 'Theme Setup'),
'created_at' => Yii::t('app', 'Created At'),
'updated_at' => Yii::t('app', 'Updated At'),
'theme_setup' => Yii::t('app', 'PHP Code'),
'theme_css' => Yii::t('app', 'CSS Code'),
'theme_js' => Yii::t('app', 'JS Code'),
];
}
public static function dropdown() {
$models = self::find()->all();
foreach ($models as $model) {
$dropdown[$model->theme_id] = $model->title;
}
return $dropdown;
}
public function getHeader() {
return $this->hasOne(FrontendHeader::className(), ['header_id' => 'header_id']);
}
public function getFooter() {
return $this->hasOne(FrontendFooter::className(), ['footer_id' => 'footer_id']);
}
}