Пример #1
0
 /**
  * Creates a new Targets model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionNew()
 {
     $model = new Targets();
     if ($model->load(Yii::$app->request->post())) {
         $model->order = $model->order != null ? $model->order : 0;
         if ($model->save()) {
             return $this->redirect(['/targets']);
         }
     }
     return $this->render('new', ['model' => $model]);
 }