/** * Creates a new TravellerHelp model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new TravellerHelp(); $traveller_id = isset($_GET['traveller_id']) ? $_GET['traveller_id'] : 0; $descriptionmodel = TravellerDescription::find()->where(['traveller_id' => $traveller_id])->one(); $profilemodel = TravellersProfile::find()->where(['traveller_id' => $traveller_id])->one(); if ($model->load(Yii::$app->request->post()) && $model->save()) { if (count($profilemodel) > 0) { return $this->redirect(['travellersprofile/update', 'id' => $profilemodel->id]); } else { return $this->redirect(['travellersprofile/create', 'traveller_id' => $model->traveller_id]); } } else { return $this->render('create', ['model' => $model, 'traveller_id' => $traveller_id, 'descriptionmodel' => $descriptionmodel, 'profilemodel' => $profilemodel]); } }