/** * Creates a new Games model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionAdd() { $model = new Games(); $model->scenario = 'addGame'; if ($model->load(Yii::$app->request->post())) { if ($model->save()) { Yii::$app->session->setFlash('status', 'Игра добавлена'); } else { Yii::$app->session->setFlash('error', $model->getFirstError('id_team_home')); } } else { Yii::$app->session->setFlash('error', 'Ошибка'); } return $this->goBack(); }