On laravel 9 filamenphp site I need to show data in tree and I found this https://github.com/solutionforest/filament-tree plugin.
But source of this plugin is 1 table, not as in my case when I need to combine data from 3 sources and 2 of them are non related tables. If there is a way to load my custom data into this plugin?
I suppose it looks some laravel feature... Has it any
"filament/filament": "^2.17.39",
"filament/forms": "^2.17.39",
"laravel/framework": "^9.52.7",
Thanks in advance!
Not sure if anyone is still using this package, but i found you can overide the getTreeQuery function to customize the getter it uses for the tree items
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
use SolutionForest\FilamentTree\Widgets\Tree as BaseWidget;
class MyWidget extends BaseWidget{
//Rest of widget
protected function getTreeQuery(): EloquentBuilder
{
return Class::query()
->where('some_id', $this->other_id);
}
}
You can probably do all sorts of things with this to customize the items the way you want to.