lazychaser / laravel-nestedset

Effective tree structures in Laravel 4-8
3.64k stars 473 forks source link

You May Ordered Children with adding this method. #585

Open irvine48 opened 1 year ago

irvine48 commented 1 year ago

In your model file,

use NodeTrait;

public function ordered_children()
{
    return $this->children()->orderBy('_lft');
}

substitute your eager loading children method with method you newly create with defined scope.

Enjoy