model = new TableModel(); } public function __invoke(ServerRequestInterface $request) { $body = json_decode((string)$request->getBody(), true) ?? []; // Validação do company_id try { v::key('company_id', v::intType()->positive()) ->assert($body); } catch (ValidationException $e) { return ResponseLib::sendFail("Validation failed: " . $e->getFullMessage(), [], "E_VALIDATE")->withStatus(422); } $companyId = $body['company_id']; $tables = $this->model->getTables((int)$companyId); if ($tables) { return ResponseLib::sendOk($tables); } return ResponseLib::sendFail("Table Not Found", [], "E_DATABASE")->withStatus(404); } }