diff --git a/src/Components/Database/Migrator.php b/src/Components/Database/Migrator.php index 8b035786..43f7f04c 100644 --- a/src/Components/Database/Migrator.php +++ b/src/Components/Database/Migrator.php @@ -15,6 +15,7 @@ use function collect; use Illuminate\Database\Migrations\Migrator as BaseMigrator; +use Illuminate\Support\Str; use SplFileInfo; use Symfony\Component\Finder\Finder; @@ -35,10 +36,16 @@ public function getMigrationFiles($paths): array return collect($paths) ->flatMap( function ($path) { - return collect( - (new Finder)->in([$path]) + if (Str::endsWith($path, '.php')) { + $finder = (new Finder)->in([dirname($path)]) ->files() - ) + ->name(basename($path)); + } else { + $finder = (new Finder)->in([$path]) + ->files(); + } + + return collect($finder) ->map( function (SplFileInfo $file) { return $file->getPathname();