From 6edb16ccbfe95550e9cdd936a7413459b12fd076 Mon Sep 17 00:00:00 2001 From: Maxime Renou Date: Fri, 29 Nov 2024 16:57:06 +0100 Subject: [PATCH] add form json --- src/Laravel/Commands/MakeAction.php | 4 ++-- src/Laravel/Commands/MakeMetric.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) 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)) {