Skip to content

Commit 0045c8a

Browse files
[9.x] Fixes constructable migrations (#46223)
* Fixes migrator on migrations with constructors * Update Migrator.php --------- Co-authored-by: Taylor Otwell <[email protected]>
1 parent 7a5774a commit 0045c8a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Illuminate/Database/Migrations/Migrator.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,9 @@ protected function resolvePath(string $path)
521521
$migration = static::$requiredPathCache[$path] ??= $this->files->getRequire($path);
522522

523523
if (is_object($migration)) {
524-
return clone $migration;
524+
return method_exists($migration, '__construct')
525+
? $this->files->getRequire($path)
526+
: clone $migration;
525527
}
526528

527529
return new $class;

0 commit comments

Comments
 (0)