etrepat / baum

Baum is an implementation of the Nested Set pattern for Laravel's Eloquent ORM.
http://etrepat.com/baum
MIT License
2.24k stars 459 forks source link

makeChildOf() function repeats indexes and returns broken tree #249

Open matiazar opened 8 years ago

matiazar commented 8 years ago

Hi Im new with baum but I have a very simple problem.

I had a new tree (made with rebuild function) so I can check it with isValidNestedSet() function and returns true.

Now, I want to add a new category to the tree. So I create it. $c = new Category($request->all()); $c->save(); if ($request->parent_id == 0) { $c->makeRoot(); } else { $c->makeChildOf($request->parent_id); }

The tree now is showing in perfect condition on screen but it isnt the same on DB. the new record has repeated his left and right indexes from others records. and if I now test the tree with isValidNestedSet() it returns false;

Why? What Im doing wrong ?

Thanks in advance.

aqlx86 commented 5 years ago

same issue..