© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•7mo ago•
1 reply
herpmcderpin

How to override relationship query "and not exists"

I'm working on a project where I've created 3 "aliases" of a model for logical reasons.

For an example, say I've created a "car" model. I have also created "race car", "passenger car" and "sports car" models. All of these models come from the same "car" table. The "aliased" models are designed so they can be matched against one-to-many junction tables (so for example, a race car would have entries in the "races" table, so for me to get a list of any race card, I just need to query against the "races" table.

Now the issue:

I'm using relationship manager to handle attaching/detaching records to the parent object (think "manufacturer".) When I try to attach a car that fits in more than one category, my select option will automatically exclude any models that have already been included. In other words, if I say that the Porsche 911 is a race car, if I try to look it up to additionally add it as a sports car, it's automatically excluded from the option results (it adds a "and not exists" to exclude the Porsche, since it's already been selected,) so the user can't choose it.

So I want to override the default behavior - I want the user to be able to select any car "model" for any category regardless of existing "attachments" but I've had no luck trying to override the default behavior (modifyQueryUsing, creating custom options, etc.)

Any help would be greatlly appreciated!
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Relationship Does Not Exists
FilamentFFilament / ❓┊help
3y ago
query override
FilamentFFilament / ❓┊help
3y ago
How to override list resource table query?
FilamentFFilament / ❓┊help
2y ago
How to completely override the search query for Select while also using relationship?
FilamentFFilament / ❓┊help
17mo ago