get(); $bar = $this->output->createProgressBar(count($oldData)); $bar->start(); $newData = []; foreach ($oldData as $key => $value) { $coordinates = explode(',', $value->coordinates); $newData[] = [ 'mp_id' => $value->mp_id ?? 0, 'name' => $value->name ?? '', 'logo' => $value->logo ?? '', 'introduce' => $value->introduce ?? '', 'imgs' => $value->imgs ?? '', 'province_id' => 2162, 'city_id' => 2163, 'region_id' => 0, 'address' => $value->address ?? '', 'tel' => $value->tel ?? '', 'lat' => $coordinates[0] ?? '', 'lng' => $coordinates[1] ?? '', 'status' => $value->status ?? 1, 'sort' => $value->sort ?? 1, 'created_at' => $value->addtime ? strtotime($value->addtime) : 0, 'updated_at' => $value->addtime ? strtotime($value->addtime) : 0, ]; $bar->advance(); } // insert new data to new table DB::table('lanzu_market')->insert($newData); $bar->finish(); return 0; } }