Closed ahmadyousefdev closed 7 years ago
Hi @ahmadalukah
This package is not support hierarchy queries. Only sorts the current data as to hierarchy.
For example:
I suppose we have some data like:
id | parent_id | name |
---|---|---|
1 | 0 | X |
2 | 1 | Y |
3 | 2 | Z |
and run the your query:
$id = [1,2,3];
$categories = Category::whereIn('id',$id)->renderAsArray();
array:1 [
0 => array:5 [
"id" => 1
"name" => "X"
"child" => array:1 [
0 => array:1 [
"id" => 2
"name" => "Y"
"child" => [
0 => array:1 [
"id" => 3
"name" => "Z"
"parent_id" => 2,
"child" => []
]
"parent_id" => 1
]
]
"parent_id" => 0
]
]
I hope, i can tell you.
Hi, for example: I want to show a list of all the sub-categories (children) under the categories number [1,2,3], when I use
it returns only those three categories [1,2,3] and it doesn't return any children.
the same result here :
There is a function in this package:
parent()
, but it only works with one parent_id like this:Is there any way to fix this?
Thanks for this amazing and easy to use package !