Your IP : 216.73.216.79


Current Path : /var/www/html/slaas/backend/models/frontendcontentcategory/
Upload File :
Current File : /var/www/html/slaas/backend/models/frontendcontentcategory/FrontendContentCategory.php

<?php

namespace backend\models\frontendcontentcategory;

use Yii;

/**
 * This is the model class for table "frontend_content_category".
 *
 * @property integer $category_id
 * @property string $category_name
 */
class FrontendContentCategory extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'frontend_content_category';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
			[['category_id'], 'integer'],
            [['category_name'], 'string'],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'category_id' => 'Category ID',
            'category_name' => 'Category Name',
        ];
    }
	
	public static function dropdown(){
		static $dropdown;
		if($dropdown == null){
			$models = static::find()->orderBy(['category_name'=>SORT_ASC])->all();
			foreach($models as $model){
				$dropdown[$model->category_id] = $model->category_name;				
			}
		}
		
		return $dropdown;
	}
}