Your IP : 216.73.216.79


Current Path : /var/www/html/dynaweb.blunetdev.com/backend/models/frontendtheme/
Upload File :
Current File : /var/www/html/dynaweb.blunetdev.com/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 [
            [['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 ID'),
            'footer_id' => Yii::t('app', 'Footer ID'),
            'theme_setup' => Yii::t('app', 'Theme Setup'),
            'created_at' => Yii::t('app', 'Created At'),
            'updated_at' => Yii::t('app', 'Updated At'),
        ];
    }

    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']);
    }
}