| Current Path : /var/www/html/mydlvsacc/backend/models/frontend/ |
| Current File : /var/www/html/mydlvsacc/backend/models/frontend/FrontendSite.php |
<?php
namespace backend\models\frontend;
use Yii;
/**
* This is the model class for table "frontend_site".
*
* @property integer $site_id
* @property string $site_name
*/
class FrontendSite extends \yii\db\ActiveRecord
{
/**
* @inheritdoc
*/
public static function tableName()
{
return 'frontend_site';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['site_name'], 'string']
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'site_id' => 'Site ID',
'site_name' => 'Site Name'
];
}
public static function dropdown(){
static $dropdown;
if($dropdown == null){
$models = static::find()->orderBy(['site_name'=>SORT_DESC])->all();
foreach($models as $model){
$dropdown[$model->site_id] = $model->site_name;
}
}
return $dropdown;
}
}