public function deleteTravellerCountries($id) { $countries = TravellersCountries::find()->where(['traveller_id' => $id])->all(); foreach ($countries as $country) { $country->delete(); } return true; }
/** * 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 TravellersCountries models. * @return mixed */ public function actionIndex() { $dataProvider = new ActiveDataProvider(['query' => TravellersCountries::find()]); return $this->render('index', ['dataProvider' => $dataProvider]); }
/** * Lists all Travellers models. * @return mixed */ public function actionImagegallery($id) { $travellerVerification = TravellersVerification::find()->where(['traveller_id' => $id])->one(); $travellercountries = TravellersCountries::find()->where(['traveller_id' => $id])->one(); return $this->render('imagegallery', ['model' => $this->findModel($id), 'travellercountries' => $travellercountries, 'traveller_id' => $id, 'travellerVerification' => $travellerVerification]); }