baum icon indicating copy to clipboard operation
baum copied to clipboard

problem to insert a category in laravel

Open hizone opened this issue 8 years ago • 6 comments

           $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 avatar Jan 06 '18 16:01 hizone

someone?

hizone avatar Jan 10 '18 21:01 hizone

facing the same issue

raxhvl avatar Jan 31 '18 11:01 raxhvl

I'm sorry but do you find the solution?

Dysey avatar Jul 06 '18 17:07 Dysey

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

hizone avatar Jul 08 '18 13:07 hizone

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

prashant93111 avatar Jan 23 '19 11:01 prashant93111

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

andreshg112 avatar Jan 31 '19 21:01 andreshg112