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