Пример #1
0
 /**
  * Creates a new MItem model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new MItem();
     if ($model->load($_POST) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->num_iid]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
Пример #2
0
 public function actionItemcreate()
 {
     $model = new MItem();
     if (\Yii::$app->request->isPost) {
         $model->load(\Yii::$app->request->post());
         if ($model->save()) {
             return $this->redirect(['itemlist']);
         } else {
             U::W($model->getErrors());
         }
     }
     return $this->render('itemcreate', ['model' => $model]);
 }