laravel-nestedset
                                
                                 laravel-nestedset copied to clipboard
                                
                                    laravel-nestedset copied to clipboard
                            
                            
                            
                        Handling of dynamic descendatsOf()
[
    {
      	"id": 1,
        "name": "Video",
        "children": [
            {
              	"id": 2,
                "name": "Workouts",
                "children": [
                    {
                      "id": 3,
                      "name": "How To's" 
                    },
                    { 
                      "id": 4,
                      "name": "Live Workouts"
                    },
                    { 
                      "id": 5,
                      "name": "Myth Busting"
                    }
                ]
            }
        ]
    }
]
I don't know if handling this scenario is possible in this package using spatie eloquent query.
It is possible to attach to a model an ids of [2, 4, 5] but what happens is descendantsOf() only allow one id.
AllowedFilter::callback('category', function ($query, $category) {
  $query->withAnyCategories($category)->orWhere(function ($query) use ($category) {
      $categories = Category::descendantsOf($category);
      return $query->withAnyCategories($categories);
  });
}),