From e1d85a49e2536c0f335097b83a5550f1fd053d19 Mon Sep 17 00:00:00 2001 From: Bjverde Date: Sat, 30 Jul 2022 14:54:45 -0300 Subject: [PATCH] :hammer: #118 update route --- controllers/CreateApiRoutesCall.class.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/controllers/CreateApiRoutesCall.class.php b/controllers/CreateApiRoutesCall.class.php index 9f82f13..1cf9893 100644 --- a/controllers/CreateApiRoutesCall.class.php +++ b/controllers/CreateApiRoutesCall.class.php @@ -75,15 +75,16 @@ public function addRouterForTable() $this->addBlankLine(); $this->addCommentTableOrView($tableType,$tableName); $tableName = ucfirst(strtolower($tableName)); - $this->addLine('$app->group(\'/'.strtolower($tableName).'\', function() use ($app) {'); - $this->addLine(ESP.'$app->get(\'\', '.$tableName.'API::class . \':selectAll\');'); - $this->addLine(ESP.'$app->get(\'/{id:[0-9]+}\', '.$tableName.'API::class . \':selectById\');'); + $this->addLine('$urlGrupo = $urlChamada.\'strtolower($tableName)\';'); + $this->addLine('$app->group($urlGrupo, function(RouteCollectorProxy $group) use ($app,$urlGrupo) {'); + $this->addLine(ESP.'$app->get($urlGrupo.\'\', '.$tableName.'API::class . \':selectAll\');'); + $this->addLine(ESP.'$app->get($urlGrupo.\'/{id:[0-9]+}\', '.$tableName.'API::class . \':selectById\');'); $this->addBlankLine(); if( $tableType == TableInfo::TB_TYPE_TABLE ){ $this->addBlankLine(); - $this->addLine(ESP.'$app->post(\'\', '.$tableName.'API::class . \':save\');'); - $this->addLine(ESP.'$app->put(\'/{id:[0-9]+}\', '.$tableName.'API::class . \':save\');'); - $this->addLine(ESP.'$app->delete(\'/{id:[0-9]+}\', '.$tableName.'API::class . \':delete\');'); + $this->addLine(ESP.'$app->post($urlGrupo.\'\', '.$tableName.'API::class . \':save\');'); + $this->addLine(ESP.'$app->put($urlGrupo.\'/{id:[0-9]+}\', '.$tableName.'API::class . \':save\');'); + $this->addLine(ESP.'$app->delete($urlGrupo.\'/{id:[0-9]+}\', '.$tableName.'API::class . \':delete\');'); } $this->addLine('});'); }