/** * Creates a new Messages model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new Messages(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->id]); } else { return $this->render('create', ['model' => $model]); } }
/** * Displays contact page. * * @return mixed */ public function actionContact() { $model = new Messages(); if ($model->load(Yii::$app->request->post()) && $model->save()) { Yii::$app->session->setFlash('success', 'Спасибо за то что связались с нами'); return $this->refresh(); } else { return $this->render('contact', ['model' => $model]); } }