1 | <?php |
||
2 | namespace Prateekkarki\Laragen\Commands; |
||
3 | |||
4 | use Illuminate\Console\Command; |
||
5 | use Artisan; |
||
6 | |||
7 | class Migrate extends Command |
||
8 | { |
||
9 | /** |
||
10 | * The name and signature of the console command. |
||
11 | * |
||
12 | * @var string |
||
13 | */ |
||
14 | protected $signature = 'laragen:migrate'; |
||
15 | |||
16 | /** |
||
17 | * The console command description. |
||
18 | * |
||
19 | * @var string |
||
20 | */ |
||
21 | protected $description = 'Laragen Migrate Database for your project'; |
||
22 | |||
23 | /** |
||
24 | * Execute the console command. |
||
25 | * |
||
26 | * @return mixed |
||
27 | */ |
||
28 | public function handle() |
||
29 | { |
||
30 | Artisan::call('migrate:fresh'); |
||
31 | $this->line(Artisan::output()); |
||
32 | |||
33 | $migrationDirs = [ |
||
34 | 'laragenDir' => 'laragen/database/migrations', |
||
35 | 'laravelDir' => 'database/migrations/laragen' |
||
36 | ]; |
||
37 | |||
38 | foreach ($migrationDirs as $dir) { |
||
39 | if(is_dir(base_path($dir)) && count(glob( base_path($dir) . '*', GLOB_MARK ))){ |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
40 | Artisan::call('migrate', [ |
||
41 | '--path' => $dir |
||
42 | ]); |
||
43 | $this->line(Artisan::output()); |
||
44 | } |
||
45 | } |
||
46 | } |
||
47 | } |
||
48 |