protected function createEnvFile(InstallForm $model)
    {
        $envFile = Yii::getAlias('@app/.env');

        if (!file_exists($envFile)) {

            $dsn = '';
            $buffer = "\n";
            $cookieKey = $this->generateRandomString();

            $buffer .= "YII_DEBUG         = 0\n";
            $buffer .= "YII_ENV           = prod\n";
            $buffer .= "APP_TIMEZONE      = {$model->timeZone}\n";
            $buffer .= "APP_LANGUAGE      = {$model->language}\n";
            $buffer .= "ADMIN_EMAIL       = {$model->email}\n";

            switch ($model->dbType) {
                case 'mysql':
                    $dsn = "mysql:host={$model->dbHost};dbname={$model->dbName}";
                    break;
            }

            $buffer .= "DB_DSN            = {$dsn}\n";
            $buffer .= "DB_USER           = {$model->dbUsername}\n";
            $buffer .= "DB_PASSWORD       = {$model->dbPassword}\n";
            $buffer .= "DB_TABLE_PREFIX   = {$model->dbTablePrefix}\n";

            $buffer .= "REQUEST_COOKIE_VALIDATION_KEY  = {$cookieKey}\n";

            file_put_contents($envFile, $buffer);
        }
    }
protected function createEnvFile(InstallForm $model)
    {
        $envFile = Yii::getAlias('@app/.env');

        if (!file_exists($envFile)) {

            $dsn = '';
            $buffer = "\n";
            $cookieKey = $this->generateRandomString();

            $buffer .= "YII_DEBUG         = 0\n";
            $buffer .= "YII_ENV           = prod\n";
            $buffer .= "APP_TIMEZONE      = {$model->timeZone}\n";
            $buffer .= "APP_LANGUAGE      = {$model->language}\n";
            $buffer .= "ADMIN_EMAIL       = {$model->email}\n";

            switch ($model->dbType) {
                case 'mysql':
                    $dsn = "mysql:host={$model->dbHost};dbname={$model->dbName}";
                    break;
            }

            $buffer .= "DB_DSN            = {$dsn}\n";
            $buffer .= "DB_USER           = {$model->dbUsername}\n";
            $buffer .= "DB_PASSWORD       = {$model->dbPassword}\n";
            $buffer .= "DB_TABLE_PREFIX   = {$model->dbTablePrefix}\n";

            $buffer .= "REQUEST_COOKIE_VALIDATION_KEY  = {$cookieKey}\n";

            file_put_contents($envFile, $buffer);
        }
    }
protected function createEnvFile ( InstallForm $ model ) { $ envFile = Yii :: getAlias ( '@app/.env' ) ; if ( ! file_exists ( $ envFile ) ) { $ dsn = '' ; $ buffer = "\n" ; $ cookieKey = $ this -> generateRandomString ( ) ; $ buffer .= "YII_DEBUG         = 0\n" ; $ buffer .= "YII_ENV           = prod\n" ; $ buffer .= "APP_TIMEZONE      = {$model->timeZone}\n" ; $ buffer .= "APP_LANGUAGE      = {$model->language}\n" ; $ buffer .= "ADMIN_EMAIL       = {$model->email}\n" ; switch ( $ model -> dbType ) { case 'mysql' : $ dsn = "mysql:host={$model->dbHost};dbname={$model->dbName}" ; break ; } $ buffer .= "DB_DSN            = {$dsn}\n" ; $ buffer .= "DB_USER           = {$model->dbUsername}\n" ; $ buffer .= "DB_PASSWORD       = {$model->dbPassword}\n" ; $ buffer .= "DB_TABLE_PREFIX   = {$model->dbTablePrefix}\n" ; $ buffer .= "REQUEST_COOKIE_VALIDATION_KEY  = {$cookieKey}\n" ; file_put_contents ( $ envFile , $ buffer ) ; } }
Create the application env file

@param InstallForm $model

@return void
Create the application env file