Example #1
0
 /**
  * Creates a new Tag model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Tag();
     if ($model->load(Yii::$app->request->post())) {
         if ($result = $model->save()) {
             $model->setActive();
             return $this->message('标签创建成功', 'success', ['view', 'id' => $model->id]);
         }
         return $this->message(array_values($model->getFirstErrors())[0], 'error');
     } else {
         //            return $this->render('create', [
         //                'model' => $model,
         //            ]);
     }
 }