/** * Check if key is empty or null from post data recieve * */ protected function _validKey($method = "POST") { if ($method == "POST") { $dataRequest = $this->request->getJsonPost(); } else { $dataRequest = $this->request->getJsonRawBody(); } if (isset($dataRequest->key)) { $this->_authData = Platform::findFirst(array("conditions" => "key = ?1", "bind" => array(1 => $dataRequest->key))); if ($this->_authData) { return true; } else { $this->setJsonResponse(ControllerBase::SUCCESS, ControllerBase::FAILED_MESSAGE, array("return" => false, "message" => "Key not found", "status" => ControllerBase::FAILED)); return false; } } else { $this->setJsonResponse(ControllerBase::SUCCESS, ControllerBase::FAILED_MESSAGE, array("return" => false, "message" => "Key parameter is empty", "status" => ControllerBase::FAILED)); return false; } }