argument('deviceid'); $all = $this->option('all'); if (empty($deviceids) && $all === false) { $this->error('You must enter device IDs, or use the --all switch.'); exit(); } if (empty($deviceids) && $all === true) { $configs = Config::where('download_status', '!=', 1)->orWhereNull('download_status')->get(); } else { $configs = Config::whereIn('device_id', $deviceids)->where('download_status', '!=', 1)->orWhereNull('download_status')->get(); } if (count($configs) === 0) { $this->info('Nothing to purge! Thanks!'); } foreach ($configs as $config) { if ($config->config_location != null) { File::delete($config->config_location); } Config::destroy($config->id); } $logmsg = count($configs) . ' invalid or failed configurations purged!'; $this->info($logmsg); activityLogIt(__CLASS__, __FUNCTION__, 'info', $logmsg, 'devices', '', '', 'config', $deviceids); return true; } }