src/Console/Commands/NetworkConfigCommand.php
protected function generateEnv()
    {
        $env = null;

        // Get the existing .env file contents to replace
        $envPath = $this->laravel->environmentFilePath();

        if (! file_exists($envPath)) {
            // Create the .env file from the example file
            copy($envPath.'.example', $envPath);
            $this->callSilent('key:generate', ['--force' => true]);
        }

        $env = file_get_contents($envPath);

        // Loop over all of the keys we can set and replace the values that are set
        foreach ($this->keys as $key => $var) {
            // Skip if it's not set
            if (! isset($this->$var)) {
                continue;
            }

            $env = preg_replace(
                $this->keyReplacementPattern($key),
                $key.'='.(is_string($this->$var) ? '"'.$this->$var.'"' : $this->$var),
                $env,
                1
            );
        }

        return $env;
    }
protected function generateEnv()
    {
        $env = null;

        // Get the existing .env file contents to replace
        $envPath = $this->laravel->environmentFilePath();

        if (! file_exists($envPath)) {
            // Create the .env file from the example file
            copy($envPath.'.example', $envPath);
            $this->callSilent('key:generate', ['--force' => true]);
        }

        $env = file_get_contents($envPath);

        // Loop over all of the keys we can set and replace the values that are set
        foreach ($this->keys as $key => $var) {
            // Skip if it's not set
            if (! isset($this->$var)) {
                continue;
            }

            $env = preg_replace(
                $this->keyReplacementPattern($key),
                $key.'='.(is_string($this->$var) ? '"'.$this->$var.'"' : $this->$var),
                $env,
                1
            );
        }

        return $env;
    }
protected function generateEnv ( ) { $ env = null ; // Get the existing .env file contents to replace $ envPath = $ this -> laravel -> environmentFilePath ( ) ; if ( ! file_exists ( $ envPath ) ) { // Create the .env file from the example file copy ( $ envPath . '.example' , $ envPath ) ; $ this -> callSilent ( 'key:generate' , [ '--force' => true ] ) ; } $ env = file_get_contents ( $ envPath ) ; // Loop over all of the keys we can set and replace the values that are set foreach ( $ this -> keys as $ key => $ var ) { // Skip if it's not set if ( ! isset ( $ this -> $ var ) ) { continue ; } $ env = preg_replace ( $ this -> keyReplacementPattern ( $ key ) , $ key . '=' . ( is_string ( $ this -> $ var ) ? '"' . $ this -> $ var . '"' : $ this -> $ var ) , $ env , 1 ) ; } return $ env ; }
Generate the full .env file by replacing values from original

@return string
Generate the full . env file by replacing values from original