Skip to content

Commit 3533698

Browse files
authored
Only change .env file when project name exists (#140)
* Only change .env file when project name exists * Only change .env file when project name exists
1 parent 5d596be commit 3533698

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

src/NewCommand.php

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -98,17 +98,19 @@ protected function execute(InputInterface $input, OutputInterface $output)
9898
}
9999

100100
if ($this->runCommands($commands, $input, $output)->isSuccessful()) {
101-
$this->replaceInFile(
102-
'APP_URL=http://localhost',
103-
'APP_URL=http://'.$name.'.test',
104-
$directory.'/.env'
105-
);
106-
107-
$this->replaceInFile(
108-
'DB_DATABASE=laravel',
109-
'DB_DATABASE='.str_replace('-', '_', strtolower($name)),
110-
$directory.'/.env'
111-
);
101+
if ($name && $name !== '.') {
102+
$this->replaceInFile(
103+
'APP_URL=http://localhost',
104+
'APP_URL=http://'.$name.'.test',
105+
$directory.'/.env'
106+
);
107+
108+
$this->replaceInFile(
109+
'DB_DATABASE=laravel',
110+
'DB_DATABASE='.str_replace('-', '_', strtolower($name)),
111+
$directory.'/.env'
112+
);
113+
}
112114

113115
if ($input->getOption('jet')) {
114116
$this->installJetstream($directory, $stack, $teams, $input, $output);

0 commit comments

Comments
 (0)