'古湖街道', 'type' => 2, 'description' => '', 'areas' => '100', 'workforce'=> '200'], ['name' => '金鹅街道', 'type' => 2, 'description' => '', 'areas' => '101', 'workforce'=> '201'], ['name' => '响石镇', 'type' => 2, 'description' => '', 'areas' => '102', 'workforce'=> '202'], ['name' => '圣灯镇', 'type' => 2, 'description' => '', 'areas' => '103', 'workforce'=> '203'], ['name' => '黄家镇', 'type' => 2, 'description' => '', 'areas' => '104', 'workforce'=> '204'], ['name' => '双凤镇', 'type' => 2, 'description' => '', 'areas' => '105', 'workforce'=> '205'], ['name' => '龙市镇', 'type' => 2, 'description' => '', 'areas' => '106', 'workforce'=> '206'], ['name' => '界市镇', 'type' => 2, 'description' => '', 'areas' => '107', 'workforce'=> '207'], ['name' => '石碾镇', 'type' => 2, 'description' => '', 'areas' => '108', 'workforce'=> '208'], ['name' => '石燕桥镇', 'type' => 2, 'description' => '', 'areas' => '109', 'workforce'=> '209'], ['name' => '胡家镇', 'type' => 2, 'description' => '', 'areas' => '110', 'workforce'=> '210'], ['name' => '云顶镇', 'type' => 2, 'description' => '', 'areas' => '111', 'workforce'=> '211'], ['name' => '普润镇', 'type' => 2, 'description' => '', 'areas' => '112', 'workforce'=> '212'], ]; DB::table('agricultural_bases')->truncate(); try { DB::begintransaction(); $this->createBases($bases); DB::commit(); } catch (Throwable $th) { DB::rollBack(); report($th); } } public function createBases(array $bases, $pid = 0) { foreach ($bases as $base) { $abase = new AgriculturalBase(); $abase->fill($base); $abase->save(); } } }