File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed
src/Illuminate/Database/Migrations Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -66,6 +66,13 @@ class Migrator
66
66
*/
67
67
protected $ paths = [];
68
68
69
+ /**
70
+ * The paths that have already been required.
71
+ *
72
+ * @var array<string, \Illuminate\Database\Migrations\Migration|null>
73
+ */
74
+ protected static $ pathsAlreadyRequired = [];
75
+
69
76
/**
70
77
* The output interface implementation.
71
78
*
@@ -511,9 +518,13 @@ protected function resolvePath(string $path)
511
518
return new $ class ;
512
519
}
513
520
514
- $ migration = $ this ->files ->getRequire ($ path );
521
+ $ migration = static :: $ pathsAlreadyRequired [ $ path ] ??= $ this ->files ->getRequire ($ path );
515
522
516
- return is_object ($ migration ) ? $ migration : new $ class ;
523
+ if (is_object ($ migration )) {
524
+ return clone $ migration ;
525
+ }
526
+
527
+ return new $ class ;
517
528
}
518
529
519
530
/**
You can’t perform that action at this time.
0 commit comments