load->model('codex/lgartcode_model', 'LgartcodeModel'); // Load set the uid of the model to let to check the permissions $this->LgartcodeModel->setUID($this->_getUID()); } /** * @return void */ public function getLgartcode() { $lgartcode = $this->get('lgartcode'); if(isset($lgartcode)) { $result = $this->LgartcodeModel->load($lgartcode); $this->response($result, REST_Controller::HTTP_OK); } else { $this->response(); } } /** * @return void */ public function postLgartcode() { if($this->_validate($this->post())) { if(isset($this->post()['lgartcode'])) { $result = $this->LgartcodeModel->update($this->post()['lgartcode'], $this->post()); } else { $result = $this->LgartcodeModel->insert($this->post()); } $this->response($result, REST_Controller::HTTP_OK); } else { $this->response(); } } private function _validate($lgartcode = NULL) { return true; } }