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