示例#1
0
 public function actionDescription()
 {
     if (Yii::$app->user->isGuest) {
         $this->redirect(Yii::$app->user->loginUrl);
     }
     $model = BMainpageMassage::find()->where(['site' => 1])->one();
     if (!$model) {
         $model = new BMainpageMassage();
     }
     if ($model->load(Yii::$app->request->post())) {
         if ($model->validate()) {
             $model->site = 1;
             $model->save();
             return $this->render('description', ['model' => $model, 'success' => true]);
         }
     }
     return $this->render('description', ['model' => $model]);
 }