/** * Creates a new Feedback model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new Feedback(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['index']); } else { return $this->render('create', ['model' => $model, 'categories' => FeedbackCategory::find()->active()->all(), 'domains' => array_combine(explode(',', Yii::getAlias('@frontendUrls')), explode(',', Yii::getAlias('@frontendUrls')))]); } }
/** * Creates a new Feedback model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new Feedback(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->id]); } else { return $this->render('create', ['model' => $model]); } }
/** * Creates a new About model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new Feedback(); if ($model->load(Yii::$app->request->post()) && $model->save()) { $mailModel = Emailf::findAll(['status' => 1]); foreach ($mailModel as $mail) { $mails[] = $mail->email; } $mailTo = $mails; $post = Yii::$app->request->post('Feedback'); $userID = $post['domain_id']; $user = \api\models\User::findOne($userID); $subject = $post['subject']; $message = $post['text']; // die(); Yii::$app->mailer->compose('feedback-html', ['name' => $user->username, 'subject' => $subject, 'message' => $message, 'date' => time()])->setSubject(Yii::t('frontend', '{app-name} | ' . $subject, ['app-name' => Yii::$app->name]))->setTo($mailTo)->send(); return $this->redirect(['index']); } else { return $this->render('create', ['model' => $model]); } }
public function actionFeedback() { $model = new Feedback(); if ($model->load(Yii::$app->request->post(), '') && $model->save()) { return ['status' => 'success', 'data' => []]; } else { return ['status' => 'fail', 'data' => ['errors' => $model->getFirstErrors()]]; } }
public function actionFeedback() { $model = new Feedback(); $success = false; if ($model->load($_POST) && $model->validate()) { $success = $model->save(false); } return $this->render('feedback', ['model' => $model, 'success' => $success]); }