因为只在一个地方调用了, 图省事没有进行扩展, 其实应该在bootstrap.php服务启动的时候使用macro进行扩展 // 实现了一个模型树 return tap(new Row())->column('12',new Tree(new KnCategory(),function (Tree $tree){ // 外挂一个获取元素id的方法 Tree::macro('getId',function (){ return $this->elementId; })…
因为只在一个地方调用了, 图省事没有进行扩展, 其实应该在bootstrap.php服务启动的时候使用macro进行扩展 // 实现了一个模型树 return tap(new Row())->column('12',new Tree(new KnCategory(),function (Tree $tree){ // 外挂一个获取元素id的方法 Tree::macro('getId',function (){ return $this->elementId; })…