lazychaser / laravel-nestedset

Effective tree structures in Laravel 4-8
3.64k stars 472 forks source link

Limit the children with specific level. #330

Open kampit opened 5 years ago

kampit commented 5 years ago
$nodes = User::descendantsOf($id)->toTree($id);

A
- B
-- C
---- D skip
- E
-- F 
---- G skip

How do I limit the children looks like above?

Originally posted by @lazychaser in https://github.com/lazychaser/laravel-nestedset/issues/98#issuecomment-206707069

yamamz commented 5 years ago

same problem... how to do this

vahidalvandi commented 5 years ago

$tree = accounts::scoped([ 'business_id' => 1 ])->withDepth()->having('depth', '>=',3)->descendantsOf(1)->toTree();

not work correctly i have same problem ; i need get level with larger than 3 deep