argument('domain'); // adding flags $domainFlags = ''; // add file for domain $saved = []; // create flags foreach($domains as $domain) { $domainFlags .= '-d '.$domain.' '; $saved[$domain] = '/etc/letsencrypt/live/'.$domain.'/fullchain.pem'; } system('certbot --non-interactive --agree-tos -m '.$this->argument('email').' --nginx '.$domainFlags); foreach($saved as $domain => $file) { if (file_exists($file)) { $this->info($domain.'...Success!'); } else { $this->error($domain.'...Failed!'); } } } }