methods['addBatchDetails_get']['limit'] = 500; // 500 requests per hour per user/key $this->methods['addBatchDetails_post']['limit'] = 100; // 100 requests per hour per user/key $this->methods['addBatchDetails_delete']['limit'] = 50; // 50 requests per hour per user/key $this->methods['getBatchDetails_post']['limit'] = 500; // 50 requests per hour per user/key $this->methods['updateBatchDetails_post']['limit'] = 500;// 500 requests per hour per user/key $this->methods['updateBatchDefault_post']['limit'] = 500;// 500 requests per hour per user/key // load the model $this->load->model('Batch_model', 'batch_model'); } /* * This method used to add batch details * created by srk * */ public function addBatchDetails_post() { $now = new DateTime(); $now->setTimezone(new DateTimezone('Asia/Kolkata')); $details['BatchCode'] = $this->post('batchcode'); $details['BatchName'] = $this->post('batcheName'); $details['BatchDate'] = $this->post('batcheDate'); $details['UniversityID'] = $this->post('universityName'); $details['CreatedBy'] = $this->post('createdBy'); $details['IsActive'] = $this->post('status'); $details['CreatedOn'] = $now->format('Y-m-d H:i:s'); $batchDetails = $this->batch_model->addBatch($details);// Check if the users data store contains users (in case the database result returns NULL) if ($batchDetails) { $batchDetails['status'] = REST_Controller::HTTP_OK; // Set the response and exit $this->response($batchDetails, 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 Batch details * created by srk * */ public function getBatchDetails_post() { $requestedBy = $this->post('requestedBy'); $getBatch = $this->batch_model->getBatch($requestedBy); if ($getBatch) { $getBatch['status'] = REST_Controller::HTTP_OK; // Set the response and exit $this->response($getBatch, 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 batch details * created by srk * */ public function updateBatchDetails_post() { $now = new DateTime(); $now->setTimezone(new DateTimezone('Asia/Kolkata')); $details['BatchCode'] = $this->post('batchCode'); $details['BatchName'] = $this->post('batchName'); $details['BatchDate'] = $this->post('batchDate'); $details['IsActive'] = $this->post('status'); $details['UpdatedBy'] = $this->post('updatedBy'); $details['UpdatedOn'] = $now->format("Y-m-d H:i:s"); // print_r( $details['UpdatedOn']) //exit(); $updateDetails = $this->batch_model->updateBatch($details);// 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 } } /* * update the default batch details * created by kms * */ public function updateBatchDefault_post() { $now = new DateTime(); $now->setTimezone(new DateTimezone('Asia/Kolkata')); $details['BatchCode'] = $this->post('batchCode'); $details['UniversityID'] = $this->post('universityID'); $details['IsDefault'] = $this->post('IsDefault'); $details['UpdatedBy'] = $this->post('updatedBy'); $details['UpdatedOn'] = $now->format("Y-m-d H:i:s"); $updateDetails = $this->batch_model->updateDefaultBatch($details);// 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 } } }