$parent
$parent :
Class Relation
$model : \think\Model
$query : \think\db\Query
getParent() : \think\Model
获取关联的所属模型
getModel() : \think\Model
获取当前的关联模型对象实例
getQuery() : \think\db\Query
获取关联的查询对象
__construct(\think\Model $parent, string $model, string $morphKey, string $morphType, string $type)
构造函数
| \think\Model | $parent | 上级模型对象  | 
                            
| string | $model | 模型名  | 
                            
| string | $morphKey | 关联外键  | 
                            
| string | $morphType | 多态字段名  | 
                            
| string | $type | 多态类型  | 
                            
getRelation(string $subRelation = '', \Closure $closure = null) : false|\PDOStatement|string|\think\Collection
延迟获取关联数据
| string | $subRelation | 子关联名  | 
                            
| \Closure | $closure | 闭包查询条件  | 
                            
has(string $operator = '>=', integer $count = 1, string $id = '*', string $joinType = 'INNER') : \think\db\Query
根据关联条件查询当前模型
| string | $operator | 比较操作符  | 
                            
| integer | $count | 个数  | 
                            
| string | $id | 关联表的统计字段  | 
                            
| string | $joinType | JOIN类型  | 
                            
hasWhere(mixed $where = array(), mixed $fields = null) : \think\db\Query
根据关联条件查询当前模型
| mixed | $where | 查询条件(数组或者闭包)  | 
                            
| mixed | $fields | 字段  | 
                            
eagerlyResult(\think\Model $result, string $relation, string $subRelation, \Closure $closure) : void
预载入关联查询
| \think\Model | $result | 数据对象  | 
                            
| string | $relation | 当前关联名  | 
                            
| string | $subRelation | 子关联名  | 
                            
| \Closure | $closure | 闭包  | 
                            
relationCount(\think\Model $result, \Closure $closure) : integer
关联统计
| \think\Model | $result | 数据对象  | 
                            
| \Closure | $closure | 闭包  | 
                            
save(mixed  $data) : \think\Model|false
                保存(新增)当前关联数据对象
| mixed | $data | 数据 可以使用数组 关联模型对象 和 关联对象的主键  |