/** * Execute the console command. * * @return void */ public function fire() { $fkCheck = $this->input->getOption('fkCheck'); $fkCheck ? null : DB::statement('SET FOREIGN_KEY_CHECKS=0;'); $this->module = $this->laravel['modules']; $arguments = $this->input->getArguments(); $name = array_key_exists('module', $arguments) && $arguments['module'] ? strtolower($arguments['module']) : null; if (!$name) { return parent::fire(); } //parent::fire(); if ($name) { return $this->dbseed($name); } foreach ($this->module->getOrdered($this->option('direction')) as $module) { $this->line('Seed for module: <info>' . $module->getName() . '</info>'); $this->dbseed($module->getDotName()); } $fkCheck ? null : DB::statement('SET FOREIGN_KEY_CHECKS=1;'); return $this->info('All modules seeded.'); if (!$this->confirmToProceed()) { return; } $this->resolver->setDefaultConnection($this->getDatabase()); $this->getSeeder()->run(); }
/** * Execute the console command. */ public function fire() { $this->dispatch(new SetAddonSeederClass($this, $this->input)); $path = $this->input->getOption('class'); if ($path && !class_exists($path)) { return $this->info('Nothing to seed.'); } parent::fire(); }
/** * Fires the command. */ public function fire() { // if no tenant option is set, simply run the native laravel seeder if (!$this->option('tenant')) { return parent::fire(); } if (!$this->option('force') && !$this->confirmToProceed()) { $this->error('Stopped no confirmation and not forced.'); return; } $websites = $this->getWebsitesFromOption(); // forces database to tenant if (!$this->option('database')) { $this->input->setOption('database', 'tenant'); } foreach ($websites as $website) { $this->info("Seeding for {$website->id}: {$website->present()->name}"); $website->database->setCurrent(); $this->resolver->setDefaultConnection($website->database->name); $this->getSeeder()->run(); } }