model = new UserModel(); } public function __invoke(ServerRequestInterface $request) { $body = json_decode((string)$request->getBody(), true) ?? []; $companyId = (int)($request->getAttribute('api_company_id') ?? 0); if ($companyId <= 0) { return ResponseLib::sendFail('Authenticated company not found', [], 'E_VALIDATE')->withStatus(401); } $users = $this->model->getUsersByCompany($companyId); return $users ? ResponseLib::sendOk($users) : ResponseLib::sendFail("User Not Found", [], "E_DATABASE")->withStatus(204); } }