public function __invoke(array $input)
 {
     if (!$this->auth->authorizeEndpoint('ListShifts')) {
         return $this->auth->errorPayload;
     }
     if (!isset($input['start_time']) || !isset($input['end_time'])) {
         return (new Payload())->withStatus(Payload::INVALID)->withOutput(['error' => 'start_time and end_time fields are required.']);
     }
     $shifts = Shift::shiftsInTimeRange($input['start_time'], $input['end_time']);
     $shifts = $shifts->with('manager')->get();
     return (new Payload())->withStatus(Payload::OK)->withOutput($shifts->toArray());
 }
 public function __invoke(array $input)
 {
     if (!$this->auth->authorizeEndpoint('ShowMyShift')) {
         return $this->auth->errorPayload;
     }
     $my_id = $this->auth->User->id;
     $my_shift = Shift::where('id', $input['id'])->first();
     if ($my_shift->employee_id != $my_id) {
         return (new Payload())->withStatus(Payload::INVALID)->withOutput($overlapping_shifts->toArray());
     }
     $overlapping_shifts = Shift::shiftsInTimeRange($my_shift->start_time, $my_shift->end_time);
     $overlapping_shifts = $overlapping_shifts->with('employee')->get();
     return (new Payload())->withStatus(Payload::OK)->withOutput(['overlapping_shifts' => $overlapping_shifts->toArray()]);
 }