public function actionIndex() { $model = new Provinsi(); $model1 = new Kota(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->G_ORDER]); } else { return $this->render('index', ['model' => $model, 'model1' => $model1]); } }
/** * Creates a new Provinsi model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new Provinsi(); if (Yii::$app->request->isPost) { $model->autoNumber(); if ($model->load(Yii::$app->request->post()) && $model->save()) { Yii::$app->getSession()->setFlash('success', Yii::t('app', 'Your data provinsi has been successfully saved')); return $this->redirect(['create']); } else { Yii::$app->getSession()->setFlash('error', Yii::t('app', 'Your data provinsi failed to save')); } } return $this->render('create', ['model' => $model]); }