diff --git a/src/Laravel/Commands/MakeAction.php b/src/Laravel/Commands/MakeAction.php index 21c6c2e..6a7ef1c 100644 --- a/src/Laravel/Commands/MakeAction.php +++ b/src/Laravel/Commands/MakeAction.php @@ -26,13 +26,13 @@ class MakeAction extends Command */ public function handle() { - $name = $this->hasArgument('name') + $name = ! empty($this->argument('name')) ? $this->argument('name') : $this->ask('What is the name of the action?', 'MakeSmoothie'); $contents = file_get_contents(__DIR__.'/../stubs/action.php'); $contents = str_replace('MakeSmoothie', $name, $contents); - $contents = str_replace('make-smoothie', Str::slug($name), $contents); + $contents = str_replace('make-smoothie', Str::snake($name, '-'), $contents); $path = app_path('Pilot/Actions/'.$name.'.php'); if (file_exists($path)) { diff --git a/src/Laravel/Commands/MakeMetric.php b/src/Laravel/Commands/MakeMetric.php index 118544b..92f6bd0 100644 --- a/src/Laravel/Commands/MakeMetric.php +++ b/src/Laravel/Commands/MakeMetric.php @@ -26,13 +26,13 @@ class MakeMetric extends Command */ public function handle() { - $name = $this->hasArgument('name') + $name = ! empty($this->argument('name')) ? $this->argument('name') : $this->ask('What is the name of the metric?', 'SmoothiesCount'); $contents = file_get_contents(__DIR__.'/../stubs/metric.php'); $contents = str_replace('SmoothiesCount', $name, $contents); - $contents = str_replace('smoothies-count', Str::slug($name), $contents); + $contents = str_replace('smoothies-count', Str::snake($name, '-'), $contents); $path = app_path('Pilot/Metrics/'.$name.'.php'); if (file_exists($path)) {