/**
  * @inheritdoc
  */
 protected function seed()
 {
     \DB::table(China::getTableName())->truncate();
     China::create(array('areano' => '100000', 'parentno' => '0', 'name' => '中国', 'flag' => '国家'));
     $file = __DIR__ . '/' . $this->csv;
     $this->csvInterpreter($file, function ($row) {
         China::insertArea($row[0], $row[1], $row[2]);
     });
 }
 protected function dsyAddChild($prefix, China $parent)
 {
     $results = array();
     //dsy.add("0",["北京市","天津市","上海市","重庆市","河北省","山西省","内蒙古","辽宁省","吉林省","黑龙江省","江苏省","浙江省","安徽省","福建省","江西省","山东省","河南省","湖北省","湖南省","广东省","广西","海南省","四川省","贵州省","云南省","西藏","陕西省","甘肃省","青海省","宁夏","新疆","香港","澳门","台湾省"]);
     $children = array();
     foreach ($parent->getChildren() as $child) {
         $children[] = '"' . $child->name . '"';
     }
     if (empty($children)) {
         return array();
     }
     $results[] = sprintf('dsy.add("%s",[%s]);', $prefix, implode(',', $children));
     $i = 0;
     foreach ($parent->getChildren() as $child) {
         $results = array_merge($results, $this->dsyAddChild($prefix . '_' . $i, $child));
         $i++;
     }
     return $results;
 }