Skip to content

Commit

Permalink
Merge pull request #45 from Schweppesale/master
Browse files Browse the repository at this point in the history
added support for a new migrate.path configuration setting to the mod…
  • Loading branch information
nWidart committed Sep 13, 2016
2 parents 56925d6 + 72b8127 commit e6accb4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
6 changes: 5 additions & 1 deletion src/Commands/MigrateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,11 @@ protected function migrate($name)
*/
protected function getPath($module)
{
$path = $module->getExtraPath(config('modules.paths.generator.migration'));
$config = $module->get('migration');

$path = (is_array($config) && array_key_exists('path', $config)) ? $config['path'] : config('modules.paths.generator.migration');

$path = $module->getExtraPath($path);

return str_replace(base_path(), '', $path);
}
Expand Down
19 changes: 14 additions & 5 deletions src/Commands/SeedCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,21 @@ public function fire()

foreach ($this->module->getOrdered() as $module) {
$name = $module->getName();

if (class_exists($this->getSeederName($name))) {
$this->dbseed($name);

$this->info("Module [$name] seeded.");
$config = $module->get('migration');
if(is_array($config) && array_key_exists('seeds', $config)) {
foreach((array)$config['seeds'] as $class) {
if (class_exists($class)) {
$this->dbseed($class);
} else {
return $this->error("Class [$class] does not exist");
}
}
} else {
if (class_exists($this->getSeederName($name))) {
$this->dbseed($name);
}
}
$this->info("Module [$name] seeded.");
}

return $this->info('All modules seeded.');
Expand Down

0 comments on commit e6accb4

Please sign in to comment.