Dynamic Select Fields
I have a recursive relationship in a table.
The table name is topics and each topic can have children and they can have their children etc.
I want the form fist show the select with options of topics that have parent_id = null.
Once selected I want another select to appear with the options that are children of selected.
And repeat this if the selected option has children until the selected item doesnt have any children.
3 Replies
I had a similar problem, in the end I built a custom page with tree form instead of a table. This extension helped a lot:
https://github.com/staudenmeir/laravel-adjacency-list
GitHub
GitHub - staudenmeir/laravel-adjacency-list: Recursive Laravel Eloq...
Recursive Laravel Eloquent relationships with CTEs - GitHub - staudenmeir/laravel-adjacency-list: Recursive Laravel Eloquent relationships with CTEs
Filament
Select Tree by CodeWithDennis - Filament
The multi-level select field lets you pick one or multiple options from a list that's neatly organized into different levels.
@qcol thank you for the suggestions, but I have a lot of data in the table so it is not good for me to load all the tree in one field. I was able to make the fields on create form, but for update form I still try to figure out a way to make it without any mess in the Resource class π