diff --git a/src/Console/InstallsApiStack.php b/src/Console/InstallsApiStack.php index f88f73cf..a8d68133 100644 --- a/src/Console/InstallsApiStack.php +++ b/src/Console/InstallsApiStack.php @@ -52,10 +52,14 @@ protected function installApiStack() copy(base_path('.env.example'), base_path('.env')); } - file_put_contents( - base_path('.env'), - preg_replace('/APP_URL=(.*)/', 'APP_URL=http://localhost:8000'.PHP_EOL.'FRONTEND_URL=http://localhost:3000', file_get_contents(base_path('.env'))) - ); + foreach (['.env', '.env.example'] as $envFile) { + $envPath = base_path($envFile); + $envContent = file_get_contents($envPath); + if (! empty($envContent)) { + $envContent = preg_replace('/APP_URL=.*/', 'APP_URL=http://localhost:8000'.PHP_EOL.'FRONTEND_URL=http://localhost:3000', $envContent); + file_put_contents($envPath, $envContent); + } + } // Tests... if (! $this->installTests()) {