Esempio n. 1
0
 public function __invoke(array $input)
 {
     $this->stories = new \stories($this->shiftModel, $this->userModel, $this->tokensModel, $this->token);
     if (!empty($input['name'])) {
         $name = $input['name'];
     }
     if (!empty($input['employeeID'])) {
         $employeeID = $input['employeeID'];
         $return = $this->stories->shiftsForEmployee($employeeID);
     }
     if (!empty($input['startTime']) && !empty($input['endTime'])) {
         $start = $input['startTime'];
         $end = $input['endTime'];
         $startTime = \DateTime::createFromFormat('m-d-Y', $start);
         $endTime = \DateTime::createFromFormat('m-d-Y', $end);
         $return = $this->stories->getEmployeesWorkingBetween($startTime, $endTime);
     }
     if (!empty($input['employeeID']) && !empty($input['startTime']) && !empty($input['endTime'])) {
         $start = $input['startTime'];
         $end = $input['endTime'];
         $employeeID = $input['employeeID'];
         $startTime = \DateTime::createFromFormat('m-d-Y', $start);
         $endTime = \DateTime::createFromFormat('m-d-Y', $end);
         $return = $this->stories->getHoursForEmployeeBetween($employeeID, $startTime, $endTime);
     }
     if (!empty($input['employeeI2D'])) {
         $employeeID = $input['employeeID2'];
         $return = $this->stories->shiftsForEmployee($employeeID);
     }
     return (new Payload())->withStatus(Payload::OK)->withOutput(['hello' => $return]);
 }
Esempio n. 2
0
 public function __invoke(array $input)
 {
     $this->stories = new \stories($this->shiftModel, $this->userModel, $this->tokensModel, $this->token);
     if (!empty($input['employeeID'])) {
         $employeeID = $input['employeeID'];
         $return = $this->stories->shiftsForEmployee($employeeID);
     } else {
         throw new \Exception('improper API usage');
     }
     return (new Payload())->withStatus(Payload::OK)->withOutput(['EmployeeShifts' => $return]);
 }