Skip to content

Commit 8ac5f76

Browse files
committed
added option to use kebab case
1 parent 26c0716 commit 8ac5f76

File tree

4 files changed

+19
-5
lines changed

4 files changed

+19
-5
lines changed

config/config.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@
3939
'package' => 'package.json',
4040
],
4141
'replacements' => [
42-
'routes/web' => ['LOWER_NAME', 'STUDLY_NAME', 'MODULE_NAMESPACE', 'CONTROLLER_NAMESPACE'],
43-
'routes/api' => ['LOWER_NAME', 'STUDLY_NAME', 'MODULE_NAMESPACE', 'CONTROLLER_NAMESPACE'],
44-
'vite' => ['LOWER_NAME', 'STUDLY_NAME'],
45-
'json' => ['LOWER_NAME', 'STUDLY_NAME', 'MODULE_NAMESPACE', 'PROVIDER_NAMESPACE'],
42+
'routes/web' => ['LOWER_NAME', 'STUDLY_NAME', 'KEBAB_NAME', 'MODULE_NAMESPACE', 'CONTROLLER_NAMESPACE'],
43+
'routes/api' => ['LOWER_NAME', 'STUDLY_NAME', 'KEBAB_NAME', 'MODULE_NAMESPACE', 'CONTROLLER_NAMESPACE'],
44+
'vite' => ['LOWER_NAME', 'STUDLY_NAME', 'KEBAB_NAME'],
45+
'json' => ['LOWER_NAME', 'STUDLY_NAME', 'KEBAB_NAME', 'MODULE_NAMESPACE', 'PROVIDER_NAMESPACE'],
4646
'views/index' => ['LOWER_NAME'],
47-
'views/master' => ['LOWER_NAME', 'STUDLY_NAME'],
47+
'views/master' => ['LOWER_NAME', 'STUDLY_NAME', 'KEBAB_NAME',],
4848
'scaffold/config' => ['STUDLY_NAME'],
4949
'composer' => [
5050
'LOWER_NAME',

src/Commands/Make/RouteProviderMakeCommand.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ protected function getTemplateContents()
6565
'WEB_ROUTES_PATH' => $this->getWebRoutesPath(),
6666
'API_ROUTES_PATH' => $this->getApiRoutesPath(),
6767
'LOWER_NAME' => $module->getLowerName(),
68+
'KEBAB_NAME' => $module->getKebabName(),
6869
]))->render();
6970
}
7071

src/Generators/ModuleGenerator.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,11 @@ protected function getLowerNameReplacement(): string
547547
return strtolower($this->getName());
548548
}
549549

550+
protected function getKebabNameReplacement(): string
551+
{
552+
return Str::kebab($this->getName());
553+
}
554+
550555
/**
551556
* Get the module name in studly case.
552557
*/

src/Module.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,14 @@ public function getStudlyName(): string
125125
return Str::studly($this->name);
126126
}
127127

128+
/**
129+
* Get name in studly case.
130+
*/
131+
public function getKebabName(): string
132+
{
133+
return Str::kebab($this->name);
134+
}
135+
128136
/**
129137
* Get name in snake case.
130138
*/

0 commit comments

Comments
 (0)