@@ 85-111 (lines=27) @@ | ||
82 | * |
|
83 | * @return array |
|
84 | */ |
|
85 | public function getMigrations($reverse = false) |
|
86 | { |
|
87 | $files = $this->laravel['files']->glob($this->getPath() . '/*_*.php'); |
|
88 | ||
89 | // Once we have the array of files in the directory we will just remove the |
|
90 | // extension and take the basename of the file which is all we need when |
|
91 | // finding the migrations that haven't been run against the databases. |
|
92 | if ($files === false) { |
|
93 | return []; |
|
94 | } |
|
95 | ||
96 | $files = array_map(function($file) { |
|
97 | return str_replace('.php', '', basename($file)); |
|
98 | ||
99 | }, $files); |
|
100 | ||
101 | // Once we have all of the formatted file names we will sort them and since |
|
102 | // they all start with a timestamp this should give us the migrations in |
|
103 | // the order they were actually created by the application developers. |
|
104 | sort($files); |
|
105 | ||
106 | if ($reverse) { |
|
107 | return array_reverse($files); |
|
108 | } |
|
109 | ||
110 | return $files; |
|
111 | } |
|
112 | ||
113 | /** |
|
114 | * Rollback migration. |
@@ 85-111 (lines=27) @@ | ||
82 | * |
|
83 | * @return array |
|
84 | */ |
|
85 | public function getSeeds($reverse = false) |
|
86 | { |
|
87 | $files = $this->laravel['files']->glob($this->getPath() . '/*_*.php'); |
|
88 | ||
89 | // Once we have the array of files in the directory we will just remove the |
|
90 | // extension and take the basename of the file which is all we need when |
|
91 | // finding the seeds that haven't been run against the databases. |
|
92 | if ($files === false) { |
|
93 | return []; |
|
94 | } |
|
95 | ||
96 | $files = array_map(function($file) { |
|
97 | return str_replace('.php', '', basename($file)); |
|
98 | ||
99 | }, $files); |
|
100 | ||
101 | // Once we have all of the formatted file names we will sort them and since |
|
102 | // they all start with a timestamp this should give us the seeds in |
|
103 | // the order they were actually created by the application developers. |
|
104 | sort($files); |
|
105 | ||
106 | if ($reverse) { |
|
107 | return array_reverse($files); |
|
108 | } |
|
109 | ||
110 | return $files; |
|
111 | } |
|
112 | } |
|
113 |