/** * Updates an existing TravellerDescription 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_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('update', ['model' => $model, 'traveller_id' => $model->traveller_id, 'traveller_help' => $traveller_help, 'traveller_photo' => $traveller_photo]); } }
/** * Updates an existing Travellers 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); $model->scenario = 'addressDetails'; if ($model->load(Yii::$app->request->post()) && $model->save()) { $traveller_photo = TravellerPhoto::find()->where(['traveller_id' => $model->id])->one(); if (count($traveller_photo) > 0) { return $this->redirect(['travellerphoto/update', 'id' => $traveller_photo->id]); } else { return $this->redirect(['travellerphoto/create', 'traveller_id' => $model->id]); } } else { return $this->render('update', ['model' => $model]); } }
/** * Lists all TravellerPhoto models. * @return mixed */ public function actionIndex() { $dataProvider = new ActiveDataProvider(['query' => TravellerPhoto::find()]); return $this->render('index', ['dataProvider' => $dataProvider]); }