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

problem to insert a category in laravel #294

Open hizone opened 6 years ago

hizone commented 6 years ago
           $businesscategory = new BusinessCategory();
          $businesscategory->title = $request->title;
          $businesscategory->parent_id = ($request->parent_id == 0) ? NULL : (int) $request->parent_id;
          $businesscategory->save();

and i get the problem: InvalidArgumentException Illegal operator and value combination.

i check that and the problem its with parent_id i can to insert only a null but i whant to insert a id of category

thanks

hizone commented 6 years ago

someone?

raxhvl commented 6 years ago

facing the same issue

Dysey commented 6 years ago

I'm sorry but do you find the solution?

hizone commented 6 years ago

yes i found a solution i build a function and inside the function i put the save() method for the categories save and after that i save regular with the laravel

prashant93111 commented 5 years ago

Before creating the root just pass parent_id as null in your input array then try to create on your model

andreshg112 commented 5 years ago

I had to delete my old records in order to solve this. The problem happens because when you have old records, lft and rgt are both null. However, those fields are need it in vendor/baum/baum/src/Baum/Move.php. imagen