Exemple #1
0
 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]);
     }
 }
Exemple #2
0
 protected function findFieldModel($id)
 {
     if (($model = TourFields::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }