File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -46,9 +46,10 @@ public function getPath()
4646 /**
4747 * Get migration files.
4848 *
49+ * @param boolean $reverse
4950 * @return array
5051 */
51- public function getMigrations ()
52+ public function getMigrations ($ reverse = false )
5253 {
5354 $ files = $ this ->laravel ['files ' ]->glob ($ this ->getPath ().'/*_*.php ' );
5455
@@ -69,6 +70,10 @@ public function getMigrations()
6970 // the order they were actually created by the application developers.
7071 sort ($ files );
7172
73+ if ($ reverse ) {
74+ return array_reverse ($ files );
75+ }
76+
7277 return $ files ;
7378 }
7479
@@ -79,7 +84,7 @@ public function getMigrations()
7984 */
8085 public function rollback ()
8186 {
82- $ migrations = $ this ->getLast ($ this ->getMigrations ());
87+ $ migrations = $ this ->getLast ($ this ->getMigrations (true ));
8388
8489 $ this ->requireFiles ($ migrations );
8590
@@ -107,7 +112,7 @@ public function rollback()
107112 */
108113 public function reset ()
109114 {
110- $ migrations = $ this ->getMigrations ();
115+ $ migrations = $ this ->getMigrations (true );
111116
112117 $ this ->requireFiles ($ migrations );
113118
You can’t perform that action at this time.
0 commit comments