对嵌套集使用Laravels Baum包我尝试在getAncestorsAndSelf()
上获取关系模型但不起作用
$tree = \App\GroupDeprecator::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
在这种情况下出了什么问题?
答案 0 :(得分:0)
你是如何解决的?代码看起来很好,应该可以工作,除非在数据库中手动更新,我会这样做:
GroupDeprecator::rebuild(true)
更新lft, rgt and depth
列