handleOnDb(); } else { //multiDB environment, need to foreach (MultiDB::$dbs as $db) { MultiDB::setDB($db); $this->handleOnDb(); } MultiDB::setDB($current_db); } } private function handleOnDb() { set_time_limit(0); //logos Company::query() ->cursor() ->each(function ($company){ $logo = @file_get_contents($company->present()->logo()); if($logo){ $path = str_replace("https://object.invoicing.co/", "", $company->present()->logo()); $path = str_replace("https://v5-at-backup.us-southeast-1.linodeobjects.com/", "", $path); Storage::disk($this->option('disk'))->put($path, $logo); } }); //documents //backups } }