orderBy('id') ->get(); return $this->json($employeeTargets); } public function saveEmployeeTarget(): ResponseInterface { $employeeTargetValidation = new \EmployeeTargetValidation(); if (!$employeeTargetValidation->getValidationResult()) { return $this->json([ 'success' => false, 'messages' => $employeeTargetValidation->getErrorMessages() ]); } $target = $this->request->getPost(); $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); return $this->json(['success' => true, 'targetID' => $targetID]); } }