From 87c0ab874f1de7473a8fd128948a8af3094c41cd Mon Sep 17 00:00:00 2001 From: Daniel Maciel Date: Fri, 4 Sep 2020 23:30:40 +0100 Subject: [PATCH 1/2] Only change .env file when project name exists --- src/NewCommand.php | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/NewCommand.php b/src/NewCommand.php index 77a12298..e5f53ed2 100644 --- a/src/NewCommand.php +++ b/src/NewCommand.php @@ -98,17 +98,19 @@ protected function execute(InputInterface $input, OutputInterface $output) } if ($this->runCommands($commands, $input, $output)->isSuccessful()) { - $this->replaceInFile( - 'APP_URL=http://localhost', - 'APP_URL=http://'.$name.'.test', - $directory.'/.env' - ); - - $this->replaceInFile( - 'DB_DATABASE=laravel', - 'DB_DATABASE='.str_replace('-', '_', strtolower($name)), - $directory.'/.env' - ); + if($name && $name !== '.'){ + $this->replaceInFile( + 'APP_URL=http://localhost', + 'APP_URL=http://'.$name.'.test', + $directory.'/.env' + ); + + $this->replaceInFile( + 'DB_DATABASE=laravel', + 'DB_DATABASE='.str_replace('-', '_', strtolower($name)), + $directory.'/.env' + ); + } if ($input->getOption('jet')) { $this->installJetstream($directory, $stack, $teams, $input, $output); From c17f0682706aaf8acd168ba292cb04a85138f47c Mon Sep 17 00:00:00 2001 From: Daniel Maciel Date: Fri, 4 Sep 2020 23:34:14 +0100 Subject: [PATCH 2/2] Only change .env file when project name exists --- src/NewCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/NewCommand.php b/src/NewCommand.php index e5f53ed2..f7524b7e 100644 --- a/src/NewCommand.php +++ b/src/NewCommand.php @@ -98,7 +98,7 @@ protected function execute(InputInterface $input, OutputInterface $output) } if ($this->runCommands($commands, $input, $output)->isSuccessful()) { - if($name && $name !== '.'){ + if ($name && $name !== '.') { $this->replaceInFile( 'APP_URL=http://localhost', 'APP_URL=http://'.$name.'.test',