|
4 | 4 |
|
5 | 5 | use Illuminate\Console\Command; |
6 | 6 | use Doctrine\DBAL\Schema\Comparator; |
| 7 | +use Illuminate\Support\Arr; |
7 | 8 | use Illuminate\Support\Facades\Schema; |
8 | 9 | use Illuminate\Support\Facades\Artisan; |
9 | 10 | use Illuminate\Database\Schema\Blueprint; |
@@ -46,13 +47,22 @@ private function runTraditionalMigrations() |
46 | 47 |
|
47 | 48 | private function runAutomaticMigrations() |
48 | 49 | { |
49 | | - foreach ((new Finder)->in(config('laravel-automatic-migrations.model_paths')) as $file) { |
50 | | - preg_match('/namespace (.*);/', $file->getContents(), $matches); |
| 50 | + $paths = Arr::wrap(config('laravel-automatic-migrations.model_paths')); |
| 51 | + $finder = new Finder; |
51 | 52 |
|
52 | | - $class = str_replace('.php', '', $matches[1] . '\\' . $file->getFilename()); |
| 53 | + foreach ($paths as $path) { |
| 54 | + if (!is_dir($path)) { |
| 55 | + continue; |
| 56 | + } |
| 57 | + |
| 58 | + foreach ($finder->in($path) as $file) { |
| 59 | + preg_match('/namespace (.*);/', $file->getContents(), $matches); |
| 60 | + |
| 61 | + $class = str_replace('.php', '', $matches[1] . '\\' . $file->getFilename()); |
53 | 62 |
|
54 | | - if (method_exists($class, 'migration')) { |
55 | | - $this->migrate($class); |
| 63 | + if (method_exists($class, 'migration')) { |
| 64 | + $this->migrate($class); |
| 65 | + } |
56 | 66 | } |
57 | 67 | } |
58 | 68 | } |
|
0 commit comments