baum
baum copied to clipboard
Load nested set by default in Laravel Relation definition
Thanks so much for taking this project over!!
Is there a way to eager load a nested relationship using Laravel's relationship definitions instead of calling ->toHierarchy()?
i.e.
class Post extends Model
{
public function categories()
{
return $this->hasManyRootsWithDescendants(Category::class);
}
}
to return a nested set of categories
If this is a feature request I'd be glad to take a look Or is there a better way to load a nested set by default?
I like this idea but I envisage it being a fair bit of work. Happy for someone to look in to it, or I'll take a look if (when) I get time.