methods['addBranchDetails_get']['limit'] = 500; // 500 requests per hour per user/key $this->methods['addBranchDetails_post']['limit'] = 100; // 100 requests per hour per user/key $this->methods['addBranchDetails_delete']['limit'] = 50; // 50 requests per hour per user/key $this->methods['getBranchDetails_post']['limit'] = 500; // 50 requests per hour per user/key $this->methods['updateBranchDetails_post']['limit'] = 500; // load the model $this->load->model('Branch_model', 'branch_model'); } /* * This method used to add branch details * created by kms * */ public function addBranchDetails_post() { $details['BranchCode'] = $this->post('branchCode'); $details['BranchName'] = $this->post('branchName'); $details['LogoPath'] = $this->post('logo'); $details['MobileNumber'] = $this->post('primaryPhone'); $details['AlternateNumber'] = $this->post('secondaryPhone'); $details['LandlineNumber'] = $this->post('landLine'); $details['Address'] = $this->post('address'); $details['EmailID'] = $this->post('email'); $details['CreatedBy'] = $this->post('createdBy'); $details['IsActive'] = $this->post('status'); $branchDetails = $this->branch_model->addBranch($details);// Check if the users data store contains users (in case the database result returns NULL) if ($branchDetails) { $branchDetails['status'] = REST_Controller::HTTP_OK; // Set the response and exit $this->response($branchDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code } else { // Set the response and exit $this->response([ 'message' => 'Something went wrong.please try again!', 'status' => REST_Controller::HTTP_NOT_FOUND ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code } } /* * get branch details * created by kms * */ public function getBranchDetails_post() { $requestedBy = $this->post('requestedBy'); $getBranch = $this->branch_model->getBranch($requestedBy); if ($getBranch) { $getBranch['status'] = REST_Controller::HTTP_OK; // Set the response and exit $this->response($getBranch, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code } else { // Set the response and exit $this->response([ 'message' => 'No records found!', 'status' => REST_Controller::HTTP_NOT_FOUND ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code } } /* * update the branch details * created by kms * */ public function updateBranchDetails_post() { $branchCode = $this->post('branchCode'); $details['BranchName'] = $this->post('branchName'); $details['LogoPath'] = $this->post('logo'); $details['MobileNumber'] = $this->post('primaryPhone'); $details['AlternateNumber'] = $this->post('secondaryPhone'); $details['LandlineNumber'] = $this->post('landLine'); $details['Address'] = $this->post('address'); $details['EmailID'] = $this->post('email'); $details['IsActive'] = $this->post('status'); $details['UpdatedBy'] = $this->post('updatedBy'); $details['UpdatedOn'] = date("Y-m-d", time()); $updateDetails = $this->branch_model->updateBranch($details,$branchCode);// Check if the users data store contains users (in case the database result returns NULL) if ($updateDetails) { $updateDetails['status'] = REST_Controller::HTTP_OK; // Set the response and exit $this->response($updateDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code } else { // Set the response and exit $this->response([ 'message' => 'Something went wrong.please try again!', 'status' => REST_Controller::HTTP_NOT_FOUND ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code } } }