public function beforeSave($insert) { if ($this->order == null) { $this->order = MainTheme::find()->select("MAX(`order`)")->scalar() + 1; } return parent::beforeSave($insert); // TODO: Change the autogenerated stub }
/** * Renders the index view for the module * @return string */ public function actionIndex() { return $this->render('index', ['themes' => new ActiveDataProvider(['query' => MainTheme::find(), 'sort' => ['defaultOrder' => ['order' => SORT_ASC]]])]); }
public static function find() { return parent::find()->where(['enabled' => 1]); }