public function actionAdd() { $model = new Test(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->render('ok'); } return $this->render('add', ['model' => $model]); }
public function actionTest() { $model = new Test(); if ($model->load(Yii::$app->request->post()) && $model->validate()) { Yii::$app->session->setFlash('success', 'yeap!'); } return $this->render('test', array('model' => $model)); }
/** * 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(\Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => (string) $model->id]); } else { return $this->render('create', ['model' => $model]); } }
public function actionTest() { $user = new User(); $ret = \Yii::$app->request->get(); if ($user->load($ret)) { if ($user->save()) { // echo 3;die; $test = new Test(); // var_dump($test->load($ret));die; if ($test->load($ret)) { $test->save(); } else { echo 4; } } } else { echo 2; } }