function __invoke(array $input) { if (!empty($input['id'])) { $users = $this->user_repository->find($input['id']); $users = [$users]; } else { $users = $this->user_repository->findBy([]); } return $this->payload->withStatus(PayloadInterface::OK)->withOutput($users); }
/** * Do any conversion from the database to actual data * * @param $arr * * @return array */ protected function convertData($arr) { $arr = $this->convertTimestampsToCarbon($arr); $arr['manager'] = $this->user_repository->find($arr['manager_id']); $arr['employee'] = $this->user_repository->find($arr['employee_id']); return $arr; }