| Current Path : /var/www/html/dosmv2/backend/models/frontendcontent/ |
| Current File : /var/www/html/dosmv2/backend/models/frontendcontent/FrontendContent.php |
<?php
namespace backend\models\frontendcontent;
use Yii;
use backend\models\frontendcontentcategory\FrontendContentCategory;
use backend\models\frontend\FrontendSite;
use backend\models\frontendtheme\FrontendTheme;
/**
* This is the model class for table "frontend_content".
*
* @property integer $content_id
* @property integer $page_id
* @property string $content_details
* @property integer $content_order
* @property integer $content_is_php
*/
class FrontendContent extends \yii\db\ActiveRecord
{
public $siteid, $sitename, $pagename;
/**
* @inheritdoc
*/
public static function tableName()
{
return 'frontend_content';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['page_id', 'theme_id','content_order', 'content_is_php','category_id'], 'integer'],
[['content_details', 'content_name', 'content_tags'], 'string'],
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'content_id' => 'Content ID',
'page_id' => 'Page ID',
'category_id' => 'Category',
'content_details' => 'Content Details',
'content_order' => 'Content Order',
'content_is_php' => 'Content Is Php',
'content_tags' => 'Content Tags'
];
}
public function getPage(){
return $this->hasOne(FrontendSite::className(),['page_id'=>'page_id']);
}
public function getCategory(){
return $this->hasOne(FrontendContentCategory::className(),['category_id'=>'category_id']);
}
public static function dropdown(){
static $dropdown;
if($dropdown == null){
$models = static::find()->all();
foreach($models as $model){
$dropdown[$model->content_id] = $model->content_name;
}
}
return $dropdown;
}
public function getTheme(){
return $this->hasOne(FrontendTheme::className(), ['theme_id' => 'theme_id']);
}
}