Example #1
0
 public function actionCreatea($type)
 {
     $model = new BillingAddress();
     $model->user_id = Yii::$app->user->identity->id;
     $model->creation_date = date("Y-m-d H:i:s");
     $model->update_date = date("Y-m-d H:i:s");
     if ($type == "D") {
         $model = new DeliveryAddress();
         $model->user_id = Yii::$app->user->identity->id;
         $model->creation_date = date("Y-m-d H:i:s");
         $model->update_date = date("Y-m-d H:i:s");
     }
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         Yii::$app->getSession()->setFlash('success', 'Felicidades tus datos han sido guardados con éxito.');
         return $this->goHome();
     } else {
         return $this->render('createa', ['model' => $model]);
     }
 }