config = \json_decode(\file_get_contents(\dirname(base_path()) . "/config.json"), 1); $options = ['--path' => 'database/migrations/tenant', '--database' => 'mysql-tenant']; if(!empty( $this->option('database'))) { $options['--database'] = $this->option('database'); } Tenant::whereNotNull('dominio')->where('dominio','<>','')->where('db','S')->chunk(10, function($tenants) use ($options) { foreach($tenants as $tenant) { Config::set('database.connections.mysql-tenant.database', "{$this->config["prefix_db"]}_ente{$tenant->codice}"); DB::purge('mysql-tenant'); $this->info("Processing: {$tenant->denominazione}"); $this->call('migrate:install', $options); } }); } } }