Skip to content

Commit

Permalink
Only change .env file when project name exists (#140)
Browse files Browse the repository at this point in the history
* Only change .env file when project name exists

* Only change .env file when project name exists
  • Loading branch information
dleicam authored Sep 5, 2020
1 parent 5d596be commit 3533698
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions src/NewCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 3533698

Please sign in to comment.