public function saveTravellerCountries($dataArray, $traveller_id, $type) { foreach ($dataArray as $record) { $modelInsert = new TravellersCountries(); $modelInsert->traveller_id = $traveller_id; $modelInsert->country_name = $record; $modelInsert->country_description = $type; $modelInsert->save(false); } 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]); } }
/** * Finds the TravellersCountries model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return TravellersCountries the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = TravellersCountries::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * 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]); }