/** * Run seeders. * * @return void * * @SuppressWarnings(PHPMD.StaticAccess) */ public function run() { Model::unguard(); try { foreach ($this->seederClasses as $seederClass) { $this->parentSeeder->call($seederClass); } } finally { Model::reguard(); } }
/** * Runs main seeders for all active modules * * @param Seeder $seeder */ public function seed(Seeder $seeder) { $this->withSeeders()->each(function ($module) use($seeder) { /* @var Module $module */ $seeder->call($module->seederClass()); }); }
protected function runSeed($class) { // Boot Laravel Framework $app = (require_once \Sledgehammer\PATH . 'bootstrap/app.php'); $request = \Illuminate\Http\Request::capture(); $app['request'] = $request; $app->bootstrapWith(['Illuminate\\Foundation\\Bootstrap\\DetectEnvironment', 'Illuminate\\Foundation\\Bootstrap\\LoadConfiguration', 'Illuminate\\Foundation\\Bootstrap\\ConfigureLogging', 'Illuminate\\Foundation\\Bootstrap\\RegisterFacades', 'Illuminate\\Foundation\\Bootstrap\\RegisterProviders', 'Illuminate\\Foundation\\Bootstrap\\BootProviders']); // Run the seeder $command = new DevutilsCommand(); // @todo implement formatter $command->setOutput(new BufferedOutput()); $seeder = new Seeder(); $seeder->setCommand($command); $seeder->setContainer($app); $seeder->call($class); // Return the result return new Alert(nl2br(Html::escape($command->getOutput()->fetch())), ['class' => 'alert alert-info']); }