Skip to content

Commit

Permalink
🔨 #118 update route
Browse files Browse the repository at this point in the history
  • Loading branch information
bjverde committed Jul 30, 2022
1 parent 5ba0813 commit e1d85a4
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions controllers/CreateApiRoutesCall.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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('});');
}
Expand Down

0 comments on commit e1d85a4

Please sign in to comment.