0
工作
我里面收集藏品看起来像:上laravel嵌套集合
=> [
[
"id" => 3,
"parent_id" => 2,
"depth" => 1,
"children" => [
[
"id" => 4,
"parent_id" => 3,
"depth" => 2,
"children" => [
[
"id" => 5,
"parent_id" => 4,
"depth" => 3,
"children" => [
[
[...]
我怎么能对这项工作? $ result->计数();
这回1
它表现得像只有1集,所以我甚至无法使用地图或每进行过滤。我需要过滤最大深度为4.
我试过拒绝(),但它也不工作。
我可以把它转换为数组,但我想用最好的收集方法...
This return me:Null – TheShun
在此处发布您的代码,而不仅仅是变量的转储 –
我在我的User模型上使用此https://github.com/franzose/ClosureTable。 为了得到这个转储我只是做: $ result = $ user-> getDescendantsTree(); 我不能在这里发布所有类的闭包表,但结果是嵌套的集合。 – TheShun