Skip to content

Commit

Permalink
Merge pull request #2002 from nWidart/add-kebab-case-option
Browse files Browse the repository at this point in the history
added option to use kebab case
  • Loading branch information
dcblogdev authored Dec 23, 2024
2 parents 9090e2d + 8ac5f76 commit 932b861
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
10 changes: 5 additions & 5 deletions config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@
'package' => 'package.json',
],
'replacements' => [
'routes/web' => ['LOWER_NAME', 'STUDLY_NAME', 'MODULE_NAMESPACE', 'CONTROLLER_NAMESPACE'],
'routes/api' => ['LOWER_NAME', 'STUDLY_NAME', 'MODULE_NAMESPACE', 'CONTROLLER_NAMESPACE'],
'vite' => ['LOWER_NAME', 'STUDLY_NAME'],
'json' => ['LOWER_NAME', 'STUDLY_NAME', 'MODULE_NAMESPACE', 'PROVIDER_NAMESPACE'],
'routes/web' => ['LOWER_NAME', 'STUDLY_NAME', 'KEBAB_NAME', 'MODULE_NAMESPACE', 'CONTROLLER_NAMESPACE'],
'routes/api' => ['LOWER_NAME', 'STUDLY_NAME', 'KEBAB_NAME', 'MODULE_NAMESPACE', 'CONTROLLER_NAMESPACE'],
'vite' => ['LOWER_NAME', 'STUDLY_NAME', 'KEBAB_NAME'],
'json' => ['LOWER_NAME', 'STUDLY_NAME', 'KEBAB_NAME', 'MODULE_NAMESPACE', 'PROVIDER_NAMESPACE'],
'views/index' => ['LOWER_NAME'],
'views/master' => ['LOWER_NAME', 'STUDLY_NAME'],
'views/master' => ['LOWER_NAME', 'STUDLY_NAME', 'KEBAB_NAME',],
'scaffold/config' => ['STUDLY_NAME'],
'composer' => [
'LOWER_NAME',
Expand Down
1 change: 1 addition & 0 deletions src/Commands/Make/RouteProviderMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ protected function getTemplateContents()
'WEB_ROUTES_PATH' => $this->getWebRoutesPath(),
'API_ROUTES_PATH' => $this->getApiRoutesPath(),
'LOWER_NAME' => $module->getLowerName(),
'KEBAB_NAME' => $module->getKebabName(),
]))->render();
}

Expand Down
5 changes: 5 additions & 0 deletions src/Generators/ModuleGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,11 @@ protected function getLowerNameReplacement(): string
return strtolower($this->getName());
}

protected function getKebabNameReplacement(): string
{
return Str::kebab($this->getName());
}

/**
* Get the module name in studly case.
*/
Expand Down
8 changes: 8 additions & 0 deletions src/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,14 @@ public function getStudlyName(): string
return Str::studly($this->name);
}

/**
* Get name in studly case.
*/
public function getKebabName(): string
{
return Str::kebab($this->name);
}

/**
* Get name in snake case.
*/
Expand Down

0 comments on commit 932b861

Please sign in to comment.