add form json

This commit is contained in:
Maxime 2024-11-29 16:57:06 +01:00
parent 52cbb95648
commit 6edb16ccbf
2 changed files with 4 additions and 4 deletions

View File

@ -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)) {

View File

@ -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)) {