© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
1 reply
abdullah_arrusi

Pass non-related for <model> data in form builder <select> from <another model> with custom query

I have a model with 4 relationships. But on create page I need to render additional select field that are not related with my model attributes and relationships.
When saving, this data from select fields must be converted into JSON contents to save select fields (initially not-related with my model) into JSONB.

Some select fields need to provide data from a large tables. This could be several million entries, for example, searching for a user by full name.
If I understand the documentation correctly, I cannot use the ->relationship(name: ..., titleAttribute: ...) method in this case - because it only works with related models. Or can it still be used for unrelated models?
How to provide data from unrelated table to my select?

I have 2 cases of using such selects:
- unrelated tables are highloaded
- unrelated tables are a small directory (less than 100 records in the table - for example, a list of regions).

1) In the first case, I use the ->searchable() method. How can I properly set up a search in unrelated tables so that the select searches for data only on certain columns? In this case, I see it advisable to immediately transfer, for example, users with the highest ratings to the select when loading the page for the first time. But if you enter a first name and last name, then the select should search strictly by first and last name. I also need to limit the number of options displayed in the selector.
2) In the second case, I want the page to be loaded with data from a small table when it is first loaded, so as not to wait for the search field in the select to send a request to the backend and return the data back. How to do it?

Please show me a usage example for all my questions.
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

custom page issue in table builder rendering another model data
FilamentFFilament / ❓┊help
3y ago
Custom Page with Form Builder
FilamentFFilament / ❓┊help
3y ago
Custom Operator in Query Builder
FilamentFFilament / ❓┊help
3y ago
send data from multi step form to another related model.but can't parse the data to other model
FilamentFFilament / ❓┊help
3y ago