/**
  * Creates a new Test model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Test();
     if ($model->load($_POST) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->q]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
Exemple #2
0
 public function actionIndex()
 {
     $model = new Test();
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
         $model->save();
     } else {
         $newmo = Test::find()->all();
     }
     return $this->render('index', ['model' => $model, 'newmo' => $newmo]);
 }