/** * @param Module $module * * @return void */ public function moduleSeed(Module $module) { $seeders = []; $name = $module->getName(); $config = $module->get('migration'); if (is_array($config) && array_key_exists('seeds', $config)) { foreach ((array) $config['seeds'] as $class) { if (@class_exists($class)) { $seeders[] = $class; } } } else { $class = $this->getSeederName($name); //legacy support if (@class_exists($class)) { $seeders[] = $class; } } if (count($seeders) > 0) { array_walk($seeders, [$this, 'dbSeed']); $this->info("Module [{$name}] seeded."); } }
/** @test */ public function it_reads_key_from_module_json_file_via_helper_method() { $this->assertEquals('Recipe', $this->module->get('name')); $this->assertEquals('0.1', $this->module->get('version')); $this->assertEquals('my default', $this->module->get('some-thing-non-there', 'my default')); }
/** * Get migration path. * * @return string */ public function getPath() { $config = $this->module->get('migration'); $path = is_array($config) && array_key_exists('path', $config) ? $config['path'] : config('modules.paths.generator.migration'); return $this->module->getExtraPath($path); }