public function actionUpdate($id) { $model = TourFields::findOne($id); if ($model->load(Yii::$app->request->post()) && $model->validate()) { $model->save(); if ($model->tour_id > 0) { return $this->redirect("/tour/{$model->tour_id}"); } else { return $this->redirect("/tour"); } } else { return $this->render('update', ['model' => $model]); } }
protected function findFieldModel($id) { if (($model = TourFields::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }