Open charanjeet5ingh opened 7 years ago
Try this: YourModel::rebuild()
As long as your children are associated by parent_id to their parent, this will rebuild your lft/rgt.
If you manually adjusted your lft/rgt using some kind of Sort Re-order, you'll be stuck re-ordering after you rebuild.
Just throw the YourModel::rebuild() in your controller and let it hit once, it will rebuild your lft/rgt
Don't forget to take YourModel::rebuild()
out of the controller after it's rebuilt. I've used this when manually adding test records to the database, it works good.
Thanks, you save my day. That command fixed lots of bug in my project :) :+1:
Try this: YourModel::rebuild()
As long as your children are associated by parent_id to their parent, this will rebuild your lft/rgt.
If you manually adjusted your lft/rgt using some kind of Sort Re-order, you'll be stuck re-ordering after you rebuild.
Just throw the YourModel::rebuild() in your controller and let it hit once, it will rebuild your
lft/rgt
I messed up the left and right columns data accidentally and i have no database backup with me can i get it back or not?