/** * Creates a new Call model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new Call(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->id]); } else { return $this->render('create', ['model' => $model]); } }
public function actionCallCreate() { $model = new Call(); $products = Product::find()->where(['top' => Product::STATUS_TOP, 'category_id' => 1])->all(); if ($model->load(Yii::$app->request->post()) && $model->save()) { Yii::$app->session->addFlash('success', 'Спасибо! Мы перезвоним Вам в ближайшее время.'); $model->sendEmail('Новый Заказать Звонок', 'call'); return $this->goHome(); } else { return $this->render('index', ['call' => $model, 'products' => $products]); } }