Exemplo n.º 1
0
 public function api_save($data)
 {
     $model = new FeedbackModel($data);
     if ($model->save()) {
         return ['result' => 'success'];
     } else {
         return ['result' => 'error', 'error' => $model->getErrors()];
     }
 }
Exemplo n.º 2
0
 public function actionIndex()
 {
     $model = new FeedbackModel();
     $request = Yii::$app->request;
     if ($model->load($request->post())) {
         $returnUrl = $model->save() ? $request->post('successUrl') : $request->post('errorUrl');
         return $this->redirect($returnUrl);
     } else {
         return $this->redirect(Yii::$app->request->baseUrl);
     }
 }
Exemplo n.º 3
0
 public function actionAwarness()
 {
     $model = new FeedbackModel();
     $request = Yii::$app->request;
     $Saved = 0;
     if ($model->load($request->post())) {
         if ($model->save()) {
             //var_dump($model->getErrors());
             $Saved = 1;
         }
     }
     return $this->render('awarness', array('model' => $model, 'Saved' => $Saved));
 }
Exemplo n.º 4
0
 public function actionDelete($id)
 {
     if ($model = Feedback::findOne($id)) {
         $model->delete();
     } else {
         $this->error = Yii::t('easyii', 'Not found');
     }
     return $this->formatResponse(Yii::t('easyii/awarness', 'Feedback deleted'));
 }