orderBy( 'id' ) ->get(); $this->json( $employeeTargets ); } public function saveEmployeeTarget() { $employeeTargetValidation = new EmployeeTargetValidation(); if ( ! $employeeTargetValidation->getValidationResult() ) return $this->json( [ 'success' => FALSE, 'messages' => $employeeTargetValidation->getErrorMessages()] ); $target = $this->input->post(); $targetID = $target['id']; unset( $target['id'] ); $target['endmonth'] = $target['endmonth'] ? $target['endmonth'] : NULL; $target['endyear'] = $target['endyear'] ? $target['endyear'] : NULL; $targetID = Employeetarget::saveTarget( $targetID, $target ); $this->json( ['success' => TRUE, 'targetID' => $targetID] ); } }