Answer the question
In order to leave comments, you need to log in
How to get a certain number of children or parents from a nested set package in laravel?
Good time.
For example: in the database there are 10 users descendants of each other.
My task is to get user id = 10.
$user::find(10);
And for this tenth user, get parents, for example, at 3 levels. That is (ninth, eighth, and seventh).
How to do it?
If so then I get all 9 parents.
$parents = $user->ancestors;
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question