<?php namespace App\Console\Commands; use Illuminate\Console\Command; class migrationOrder extends Command { /** * The name and signature of the console command. * * @var string */ protected $signature = 'migrate_in_order'; /** * The console command description. * * @var string */ protected $description = 'This method migrate tables in order'; /** * Create a new command instance. * * @return void */ public function __construct() { parent::__construct(); } /** * Execute the console command. * * @return int */ public function handle() { $migrations = [ '2014_10_12_000000_create_users_table.php', '2014_10_12_100000_create_password_resets_table.php', // '2014_10_12_200000_add_two_factor_columns_to_users_table.php', '2019_08_19_000000_create_failed_jobs_table.php', // '2019_12_14_000001_create_personal_access_tokens_table.php', // '2020_11_12_102755_create_sessions_table.php', '2020_11_24_144826_create_category_table.php', '2020_11_27_082400_game_table.php', '2020_11_26_144745_create_tournament_table.php', '2020_11_27_143058_create_part_table.php', '2020_11_27_144427_create_participation_table.php', '2020_11_28_142001_create_play_table.php' ]; foreach($migrations as $migration) { $basePath = 'database/migrations/'; $migrationName = trim($migration); $path = $basePath.$migrationName; $this->call('migrate:refresh', [ '--path' => $path , ]); } } }