使用laravels baum软件包用于嵌套集,我尝试在getAncestorsAndSelf()
上获取关系模型,但不起作用
$tree = AppGroupDeprecator::where('id', $this->team_id)->with('lead')->first();
dd($tree); //this one shows the user object
dd($tree->getAncestorsAndSelf());//this one does not shows the user object
在这种情况下出了什么问题?
您如何解决它?该代码看起来不错并且应该工作,除非在数据库中手动更新,否则我会做:
GroupDeprecator::rebuild(true)
更新lft, rgt and depth
列