Exemple #1
0
 public function actionRules()
 {
     if (Yii::$app->user->isGuest) {
         $this->redirect(Yii::$app->user->loginUrl);
     }
     $model = BRules::find()->where(['site' => 1])->one();
     if (!$model) {
         print_r($_POST);
         $model = new BRules();
         $model->site = 1;
     }
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->render('rules', ['model' => $model, 'success' => true]);
     }
     return $this->render('rules', ['model' => $model]);
 }
Exemple #2
0
 public function actionRules()
 {
     $model = BRules::find()->where(['site' => 1])->one();
     $title = $model->title;
     $text = $model->text;
     $keywords = $model->keywords;
     $description = $model->description;
     return $this->render('rules', ['title' => $title, 'text' => $text]);
 }