laravel-nestedset
                                
                                 laravel-nestedset copied to clipboard
                                
                                    laravel-nestedset copied to clipboard
                            
                            
                            
                        Node must exists.
Hello developer team how can I fix this error on production? even its working fine on my localhost
Hi @aqshah20 check your table structure. Make sure you have added the nested fields on your table migration
Schema::create('table', function (Blueprint $table) {
    ...
    $table->nestedSet();
});
Hello Leandro Diógenes,
It added working fine on localhost but having issue on production
On Mon, Sep 5, 2022 at 6:17 PM Leandro Diógenes @.***> wrote:
Hi @aqshah20 https://github.com/aqshah20 check your table structure. Make sure you have added the nested fields on your table migration
Schema::create('table', function (Blueprint $table) { ... $table->nestedSet(); });
— Reply to this email directly, view it on GitHub https://github.com/lazychaser/laravel-nestedset/issues/564#issuecomment-1237012251, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFKV6PBWB3HDKTGXLYQUTRTV4XXGVANCNFSM6AAAAAAQE7M6AI . You are receiving this because you were mentioned.Message ID: @.***>
Check your tablet structure, maybe there is something missing on production table
I checked local and production table structure is same but don't know why having issue
That error is trown when you dont have values on lft and rgt Fields of any node, check your tablet data.
one thing more in my table already has more than 1000 rows than how I can update nodes?
@aqshah20, this is what I did to fix my existing records:
$counter = 1;
foreach (Posts::orderBy('id')->get() as $post) {
    $post->_lft = $counter++;
    $post->_rgt = $counter++;
    $post->save();
}
Fresh install, but this is still present:
   protected function assertNodeExists(self $node)
    {
        if ( ! $node->getLft() || ! $node->getRgt()) {
            throw new LogicException('Node must exists.');
        }
        return $this;
    }
and the package often sets _lft or _rgt to zero and then complains.