protected function setHashInEnvironmentFile($hash)
    {
        $envPath = $this->laravel->environmentFilePath();
        $envContent = $this->filesystem->get($envPath);

        $regex = '/UNDER_CONSTRUCTION_HASH=\S+/';

        if (preg_match($regex, $envContent)) {
            $hash = str_replace(['\\', '$'], ['', '\$'], $hash);
            $envContent = preg_replace($regex, $this->newLine($hash), $envContent);
        } else {
            $envContent .= "\n".$this->newLine($hash)."\n";
        }

        $this->filesystem->put($envPath, $envContent);
    }