load->model( $models ); $this->load->library( $libraries ); } public function index() { } public function getAllCustomers( $archive = 'F' ) { $users = Customer::getAllCustomers( $archive ); $this->json( $users ); } public function saveCustomer() { $userValidation = new CustomerValidation(); if ( ! $userValidation->getValidationResult() ) return $this->json( [ 'success' => FALSE, 'messages' => $userValidation->getErrorMessages()] ); $user = $this->input->post(); $userID = $user['id']; unset( $user['id'] ); $userID = Customer::saveCustomer( $userID, $user ); $this->json( ['success' => TRUE, 'userID' => $userID] ); } public function archiveCustomer( $userID, $status ) { Customer::whereId( $userID )->update( ['archive' => $status] ); } public function removeCustomer( $userID ) { $removeCustomer = new RemoveCustomer( $userID ); if ( $removeCustomer->getAllowDelete() === FALSE ) return $this->json( ['result' => FALSE] ); Customer::removeCustomer( $userID ); $this->json( ['result' => TRUE] ); } }