'database/migrations/tenant', '--database' => 'mysql-tenant']; if(!empty( $this->option('force'))) { $options['--force'] = true; } if(!empty( $this->option('step'))) { $options['--step'] = true; } if(!empty( $this->option('pretend'))) { $options['--pretend'] = true; } Tenant::whereNotNull('dominio')->where('dominio','<>','N')->where('db','S')->chunk(10, function($tenants) use ($options) { foreach($tenants as $tenant) { config(['database.connections.mysql-tenant.database' => config('json.prefix_db') . "_ente{$tenant->codice}"]); \Illuminate\Support\Facades\DB::purge('mysql-tenant'); $this->info("Processing: {$tenant->denominazione}"); $this->call('migrate:rollback', $options); } }); } }