/** * Updates an existing TravellersBestThing model. * If update is successful, the browser will be redirected to the 'view' page. * @param integer $id * @return mixed */ public function actionUpdate($id) { $model = $this->findModel($id); $traveller_id = $model->traveller_id; $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]); } }
/** * Lists all TravellersLifeAgenda models. * @return mixed */ public function actionIndex() { $dataProvider = new ActiveDataProvider(['query' => TravellersLifeAgenda::find()]); return $this->render('index', ['dataProvider' => $dataProvider]); }