Exemple #1
0
 /**
  * Retrieves a list of all available tenants.
  * 
  * @return array
  */
 protected function getTenants()
 {
     if ($this->tenants == null) {
         $this->tenants = $this->manager->getRepository()->getTenants();
     }
     return $this->tenants;
 }
Exemple #2
0
 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     $tenants = $this->manager->getRepository()->getTenants();
     $seeder = $this->getSeeder();
     foreach ($tenants as $tenant) {
         $this->manager->bootstrapConnectionByTenantName($tenant->tenant_name);
         $this->resolver->setDefaultConnection($tenant->tenant_name);
         $this->manager->assumeTenant($tenant->id, true);
         $seeder->run();
         $this->output->writeln('<info>Seeded tenant ' . $tenant->tenant_name . '</info>');
         $this->manager->restoreTenant();
     }
 }