public function saveAll(array $dataSet, array $pivot = [])
{
$result = false;
foreach ($dataSet as $key => $data) {
// 判断关联类型
switch ($this->type) {
case self::HAS_MANY:
$data[$this->foreignKey] = $this->parent->{$this->localKey};
$result = $this->save($data);
break;
case self::BELONGS_TO_MANY:
// TODO
$result = $this->attach($data, !empty($pivot) ? $pivot[$key] : []);
break;
}
}
return $result;
}