load->model('system/server_model', 'ServerModel'); // Load set the uid of the model to let to check the permissions $this->ServerModel->setUID($this->_getUID()); } /** * @return void */ public function getServer() { $serverID = $this->get('server_id'); if(isset($serverID)) { $result = $this->ServerModel->load($serverID); $this->response($result, REST_Controller::HTTP_OK); } else { $this->response(); } } /** * @return void */ public function postServer() { if($this->_validate($this->post())) { if(isset($this->post()['server_id'])) { $result = $this->ServerModel->update($this->post()['server_id'], $this->post()); } else { $result = $this->ServerModel->insert($this->post()); } $this->response($result, REST_Controller::HTTP_OK); } else { $this->response(); } } private function _validate($server = NULL) { return true; } }