/** * Update current Estate model * * @param int $id * @return string|\yii\web\Response * @throws ForbiddenHttpException * @throws NotFoundHttpException */ public function actionUpdate($id) { $model = $this->findEstate($id); $streets = Street::getStreetsArrayByCityId(City::DEFAULT_CITY); if ($model->load(Yii::$app->request->post()) && $model->validate() && $model->save()) { Yii::$app->session->setFlash('success', Yii::t('app', 'FLASH_ESTATE_UPDATED')); return $this->redirect(['view', 'id' => $model->id]); } else { return $this->render('update', ['model' => $model, 'streets' => $streets]); } }