/** * Updates an existing news model. * If update is successful, the browser will be redirected to the 'view' page. * @param string $id * @return mixed */ public function actionUpdate($id) { $model = $this->findModel($id); $tournaments = News::listDropDownPrep(); if ($model->load(Yii::$app->request->post()) && $model->validate()) { if ($model->isAttributeChanged('body') || $model->isAttributeChanged('subject')) { $model->save(); Yii::$app->session->setFlash('success', 'Новость успешно изменена'); return $this->goBack(); } } return $this->render('update', ['model' => $model, 'tournaments' => $tournaments]); }