protected function writeNewEnvironmentFileWith($key)
    {
        file_put_contents(base_path('.env'), preg_replace(
            $this->keyReplacementPattern(),
            'APP_KEY='.$key,
            file_get_contents(base_path('.env'))
        ));
    }