public function actionAddCategoryDefault() { $post = Yii::$app->request->post(); if (isset($post["category"]) and $post["category"] != 0) { $id_category = $post["category"]; $RSettings = RSettings::findOne(['type' => 'category', 'value' => $id_category]); $count = RSettings::find()->where(['type' => 'category'])->count(); if (!$RSettings and $count < 6) { $cat = new RSettings(); $cat->type = 'category'; $cat->value = $id_category; $cat->save(); } } $this->redirect(['cabinet/default']); }
public function getPreTexts() { return RSettings::find()->where(['type' => 'preText'])->all(); }