/** * @param $id * @return $this|array */ public function actionUpdate($id) { $app = Yii::$app; $request = $app->request; $response = $app->response; /* @var $model HotelRecord */ $model = TourRecord::findOne($id); $model->setScenario('update'); if ($model->load($request->post())) { if ($request->isAjax) { $response->format = Response::FORMAT_JSON; return ActiveForm::validate($model); } if ($model->save()) { return $response->redirect(['tour/index']); } } return $this->render('update', ['model' => $model]); }