diff --git a/cli/Valet/Site.php b/cli/Valet/Site.php
index 5ef7311b7..f2b810776 100644
--- a/cli/Valet/Site.php
+++ b/cli/Valet/Site.php
@@ -484,6 +484,37 @@ function unsecure($url)
));
}
+ function unsecureAll()
+ {
+ $tld = $this->config->read()['tld'];
+
+ $secured = $this->parked()
+ ->merge($this->links())
+ ->sort()
+ ->where('secured', ' X');
+
+ if ($secured->count() === 0) {
+ return info('No sites to unsecure. You may list all servable sites or links by running valet parked or valet links.');
+ }
+
+ info('Attempting to unsecure the following sites:');
+ table(['Site', 'SSL', 'URL', 'Path'], $secured->toArray());
+
+ foreach ($secured->pluck('site') as $url) {
+ $this->unsecure($url . '.' . $tld);
+ }
+
+ $remaining = $this->parked()
+ ->merge($this->links())
+ ->sort()
+ ->where('secured', ' X');
+ if ($remaining->count() > 0) {
+ warning('We were not succesful in unsecuring the following sites:');
+ table(['Site', 'SSL', 'URL', 'Path'], $remaining->toArray());
+ }
+ info('unsecure --all was successful.');
+ }
+
/**
* Get the path to the linked Valet sites.
*
diff --git a/cli/valet.php b/cli/valet.php
index 57402cce0..62230f015 100755
--- a/cli/valet.php
+++ b/cli/valet.php
@@ -164,7 +164,13 @@
/**
* Stop serving the given domain over HTTPS and remove the trusted TLS certificate.
*/
- $app->command('unsecure [domain]', function ($domain = null) {
+ $app->command('unsecure [domain] [--all]', function ($domain = null, $all) {
+
+ if ($all) {
+ Site::unsecureAll();
+ return;
+ }
+
$url = ($domain ?: Site::host(getcwd())).'.'.Configuration::read()['tld'];
Site::unsecure($url);