32], [['CATE_NAME'], 'string', 'max' => 20], [['CATE_NAME'], 'unique'], [['ID'], 'unique'], ]; } /** * @inheritdoc */ public function attributeLabels() { return [ 'ID' => 'ID', 'CATE_NAME' => Yii::t('app', 'category'), 'STATUS' => Yii::t('app', 'status'), 'SORT' => Yii::t('app', 'sort'), 'CREATED_AT' => Yii::t('app', 'createAt'), ]; } /** * 获取全部分类 * @return array|\yii\db\ActiveRecord[] */ public static function getAllCategory(){ return ArticleCategory::find()->where('STATUS=1')->indexBy('ID')->orderBy('SORT ASC')->asArray()->all(); } }