I can get descendants from one ID like this:
return $node = \App\Categories::where('id',41)
->first()
->getDescendants()->pluck('id');
I wonder if it's possible to get descendants of several ids with the same method?
I tried a "whereIn" like this but it doesn't work:
return $node = \App\Categories::whereIn('id', array(41,94))
->get()
->getDescendants()
->pluck('id');
I believe ->get()
returns a Collection and I haven't succeeded in using a Baum/Node function on a Collection.
So I can only use them on single models?
So, should I loop through the ids and use getDescendants()
on each id, is that the recommended way to do it?