系统文件下
文件中
如此修改,便可以拿到数据
/** * 组装Pivot模型 * @access public * @param Model $result 模型对象 * @return array */ protected function matchPivot(Model $result): array { $pivot = []; foreach ($result->getData() as $key => $val) { if (strpos($key, '__')) { [$name, $attr] = explode('__', $key, 2); if ('pivot' == strtolower($name)) { $pivot[$attr] = $val; unset($result->$key); } } } $result->setRelation($this->pivotDataName, $this->newPivot($pivot)); return $pivot; }