Skip to content

Commit

Permalink
Merge pull request #1945 from alissn/FixMigrationRegister
Browse files Browse the repository at this point in the history
Fix Migration Auto-Discovery for Active Modules
  • Loading branch information
dcblogdev authored Sep 17, 2024
2 parents 27d90b2 + 13ec27b commit 797c06b
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions src/LaravelModulesServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,16 +105,10 @@ protected function registerMigrations(): void
}

$this->app->resolving(Migrator::class, function (Migrator $migrator) {
$path = implode(DIRECTORY_SEPARATOR, [
$this->app['config']->get('modules.paths.modules'),
'*',
'[Dd]atabase',
'migrations',
]);

collect(glob($path, GLOB_ONLYDIR))
->each(function (string $path) use ($migrator) {
$migrator->path($path);
$migration_path = $this->app['config']->get('modules.paths.generator.migration.path');
collect(\Nwidart\Modules\Facades\Module::allEnabled())
->each(function (\Nwidart\Modules\Laravel\Module $module) use ($migration_path, $migrator) {
$migrator->path($module->getExtraPath($migration_path));
});
});
}
Expand Down

0 comments on commit 797c06b

Please sign in to comment.