Exemplo n.º 1
0
 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]);
     }
 }
Exemplo n.º 2
0
 /**
  * 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]);
 }
Exemplo n.º 3
0
 /**
  * Creates a new Kecamatan model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Kecamatan();
     $modelProvinsi = new Provinsi(['scenario' => 'DepDrop']);
     if (Yii::$app->request->isPost) {
         $model->load(Yii::$app->request->post());
         $modelProvinsi->load(Yii::$app->request->post());
         $model->autoNumber();
         if (Model::validateMultiple([$model, $modelProvinsi]) && $model->save()) {
             Yii::$app->getSession()->setFlash('success', Yii::t('app', 'Your data kecamatan has been successfully saved'));
             return $this->redirect(['create']);
         } else {
             Yii::$app->getSession()->setFlash('error', Yii::t('app', 'Your data kecamatan failed to save'));
         }
     }
     return $this->render('create', ['model' => $model, 'modelProvinsi' => $modelProvinsi]);
 }