Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the generated API routes #187

Merged
merged 2 commits into from
Sep 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "crestapps/laravel-code-generator",
"license": "MIT",
"description": "An intelligent code generator for Laravel framework that will save you time! This awesome tool will help you generate resources like views, controllers, routes, migrations, languages and/or form-requests! It is extremely flexible and customizable to cover many on the use cases. It is shipped with cross-browsers compatible template, along with a client-side validation to modernize your application.",
"version": "v2.4.8",
"version": "v2.4.9",
"keywords": [
"laravel","crud","crud generator",
"laravel crud generator","laravel crud builder",
Expand Down
9 changes: 4 additions & 5 deletions src/Commands/Framework/CreateRoutesCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class CreateRoutesCommand extends Command
{--routes-prefix=default-form : Prefix of the route group.}
{--controller-directory= : The directory where the controller is under.}
{--without-route-clause : Create the routes without where clause for the id.}
{--routes-type= : The type of the route to create "api", "api-docs" or web.}
{--routes-type= : The type of the route to create. (i.e., "api", "api-docs" or "web".)}
{--api-version= : The api version to prefix your resurces with.}
{--template-name= : The template name to use when generating the code.}';

Expand Down Expand Up @@ -62,11 +62,10 @@ public function handle()
}

$stub = $this->getRoutesStub($input->type);
$controllnerName = $this->getControllerName($input->controllerName, $input->controllerDirectory);
$controllerNamespace = $this->getControllersNamespace($controllnerName, $input->controllerDirectory);
$controllerNamespace = $this->getControllersNamespace($input->controllerName, $input->controllerDirectory);
$useControllerLine = $this->getUseClassCommand($controllerNamespace);
$this->replaceModelName($stub, $input->modelName)
->replaceControllerName($stub, $controllnerName)
->replaceControllerName($stub, $input->controllerName)
->replaceRouteNames($stub, $this->getModelName($input->modelName), $namePrefix)
->processRoutesGroup($stub, $input)
->replaceRouteIdClause($stub, $this->getRouteIdClause($input->withoutRouteClause))
Expand All @@ -89,7 +88,7 @@ protected function getControllersNamespace($controllnerName, $controllerDirector
{
$controllerPath = Config::getControllersPath($controllerDirectory);

$path = Helpers::getAppNamespace($controllerDirectory, $controllerPath, $controllnerName);
$path = Helpers::getAppNamespace($controllerPath, $controllnerName);

return Helpers::fixNamespace($path);
}
Expand Down