info('No need to update.'); return; } $players = Player::where('tid_skin', -1)->get(); $count = $players->count(); if ($count == 0) { $this->dropColumn(); $this->info('No need to update.'); return; } $this->info('We are going to update your `players` table. Please wait...'); $bar = $this->output->createProgressBar($count); $players->each(function ($player) use ($bar) { $player->tid_skin = $player->preference == 'default' ? $player->tid_steve : $player->tid_alex; $player->save(); $bar->advance(); }); $this->dropColumn(); $bar->finish(); $this->info("\nCongratulations! We've updated $count rows."); } private function dropColumn() { Schema::table('players', function (Blueprint $table) { $table->dropColumn(['tid_steve', 'tid_alex', 'preference']); }); } }