Exemplo n.º 1
0
 /**
  * @access public
  * @return JSON
  */
 public function create()
 {
     if (!$this->input->is_ajax_request()) {
         echo json_encode(["success" => false]);
         exit;
     }
     if ($this->input->post("feedback")) {
         if (!$this->_validate()) {
             echo json_encode(["success" => false, "message" => validation_errors()]);
             exit;
         }
         $feedback = new UserFeedback();
         $feedback->populate($this->input->post());
         $feedback->setUserId($this->_user->id);
         if ($feedback->save() !== false) {
             echo json_encode(["success" => true]);
             exit;
         }
     }
 }