Ejemplo n.º 1
0
 /**
  * Страница добавления метки.
  *
  * @return string|\yii\web\Response
  */
 public function actionCreate()
 {
     $modelTag = new Tag();
     if ($modelTag->load(Yii::$app->request->post()) && $modelTag->save()) {
         return $this->redirect(['back-tag/view', 'id' => $modelTag->id]);
     }
     return $this->render('/back/tag/create', ['modelTag' => $modelTag]);
 }
Ejemplo n.º 2
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()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->tag_id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
Ejemplo n.º 3
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,
         //            ]);
     }
 }