get(); $bar = $this->output->createProgressBar(count($oldData)); $bar->start(); $newData = []; foreach ($oldData as $key => $value) { $newData[] = [ 'user_id' => $value->user_id ?? '', 'user_name' => $value->user_name ?? '', 'address' => $value->address ?? '', 'gender' => $value->sex ?? 0, 'lat' => $value->lat ?? '', 'lng' => $value->lng ?? '', 'tel' => $value->tel ?? '', 'tags' => json_encode([]), 'created_at' => time(), 'updated_at' => time(), ]; $bar->advance(); } // insert new data to new table DB::table('lanzu_user_address')->insert($newData); $bar->finish(); return 0; } }