© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
16 replies
Mark Chaney

Select with BelongsToMany without multiple()?

Trying to work with an existing model setup. Have two relationships. One just gets a list of contacts and you can pick multiple. The other lets you simple pick 1 as your primary contact. They are both stored in the same table, there is just an additional boolean column for setting it as primary or not. Everything works great for loading the relationship and saving at this point, but I obviously dont want multiple() for the primary contact. Suggestions? The primary relationship is something like
$this->contacts()->wherePivot('primary', 1);
$this->contacts()->wherePivot('primary', 1);
with ->contacts() being a
belongstomany()
belongstomany()
. Im using saveRelationshipsUsing() to handle the saving part. Like I said, everything works great except for multiple() requirement as Select wont work with belongstomany().
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

Multiple Select with BelongsToMany relationship
FilamentFFilament / ❓┊help
3y ago
select filter with belongsToMany
FilamentFFilament / ❓┊help
3y ago
Single select with belongsToMany relationship
FilamentFFilament / ❓┊help
3mo ago
Dependant select with BelongsToMany relation
FilamentFFilament / ❓┊help
3y ago