src/Console/Commands/Install/UnisysApiInitializeEnv.php
private function getDbSettings()
    {
        if(env('DB_DATABASE') == 'homestead' && $this->input->isInteractive()) {

            $dbConnection = $this->choice('What database driver do you use?', ['mysql', 'pgsql'], 0);

            if(!empty($dbConnection)) {
                $this->strReplaceInFile(base_path('.env'),
                    'DB_CONNECTION=mysql',
                    'DB_CONNECTION='.$dbConnection);
            }

            $dbHost = $this->anticipate('What is your database host?', ['localhost', '127.0.0.1'], 'localhost');

            if(!empty($dbHost)) {
                $this->strReplaceInFile(base_path('.env'),
                    'DB_HOST=127.0.0.1',
                    'DB_HOST='.$dbHost);
            }

            $dbPort = $this->anticipate('What is your database port?', ['3306', '5432'], env('DB_DATABASE') == 'mysql' ? '3306' : '5432');

            if(!empty($dbPort)) {
                $this->strReplaceInFile(base_path('.env'),
                    'DB_PORT=3306',
                    'DB_PORT='.$dbPort);
            }

            $DbDatabase = $this->ask('What is your database name?', 'homestead');

            if(!empty($DbDatabase)) {
                $this->strReplaceInFile(base_path('.env'),
                    'DB_DATABASE=homestead',
                    'DB_DATABASE='.$DbDatabase);
            }

            $dbUsername = $this->ask('What is your database user name?', 'root');

            if(!empty($dbUsername)) {
                $this->strReplaceInFile(base_path('.env'),
                    'DB_USERNAME=homestead',
                    'DB_USERNAME='.$dbUsername);
            }

            $dbPassword = $this->ask('What is your database user password?', 'root');

            if(!empty($dbPassword)) {
                $this->strReplaceInFile(base_path('.env'),
                    'DB_PASSWORD=secret',
                    'DB_PASSWORD='.$dbPassword);
            }
        }
    }
private function getDbSettings()
    {
        if(env('DB_DATABASE') == 'homestead' && $this->input->isInteractive()) {

            $dbConnection = $this->choice('What database driver do you use?', ['mysql', 'pgsql'], 0);

            if(!empty($dbConnection)) {
                $this->strReplaceInFile(base_path('.env'),
                    'DB_CONNECTION=mysql',
                    'DB_CONNECTION='.$dbConnection);
            }

            $dbHost = $this->anticipate('What is your database host?', ['localhost', '127.0.0.1'], 'localhost');

            if(!empty($dbHost)) {
                $this->strReplaceInFile(base_path('.env'),
                    'DB_HOST=127.0.0.1',
                    'DB_HOST='.$dbHost);
            }

            $dbPort = $this->anticipate('What is your database port?', ['3306', '5432'], env('DB_DATABASE') == 'mysql' ? '3306' : '5432');

            if(!empty($dbPort)) {
                $this->strReplaceInFile(base_path('.env'),
                    'DB_PORT=3306',
                    'DB_PORT='.$dbPort);
            }

            $DbDatabase = $this->ask('What is your database name?', 'homestead');

            if(!empty($DbDatabase)) {
                $this->strReplaceInFile(base_path('.env'),
                    'DB_DATABASE=homestead',
                    'DB_DATABASE='.$DbDatabase);
            }

            $dbUsername = $this->ask('What is your database user name?', 'root');

            if(!empty($dbUsername)) {
                $this->strReplaceInFile(base_path('.env'),
                    'DB_USERNAME=homestead',
                    'DB_USERNAME='.$dbUsername);
            }

            $dbPassword = $this->ask('What is your database user password?', 'root');

            if(!empty($dbPassword)) {
                $this->strReplaceInFile(base_path('.env'),
                    'DB_PASSWORD=secret',
                    'DB_PASSWORD='.$dbPassword);
            }
        }
    }
/*
If default database name in env is present and interaction mode is on,
asks for database settings. Not provided values will not be overwritten.