© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
1 reply
Toni

ManyToMany Relationship via Select element

Why do I have to set a Select-Element to
->multiple()
->multiple()
in case of belongsToMany?
The use case why I am asking is, that I have a manyToMany relationship between users and institutes.
- In case a user has a system role, no relationship is needed
- In case a user has a monocentric role, the relationship is oneToMany (seen from a institute perspective)
- In case a user has a multicentric role, the relationship turns into manyToMany.

I would like to solve this with a Select-Element and make it multiple or not, depending on the role. But if multiple is false, I got an error message:

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'institutes' in 'field list' (Connection: mysql, SQL: update `users` set `institutes` = 2, `users`.`updated_at` = 2024-06-09 15:39:09 where `id` = 1)
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'institutes' in 'field list' (Connection: mysql, SQL: update `users` set `institutes` = 2, `users`.`updated_at` = 2024-06-09 15:39:09 where `id` = 1)


If I turn the select element to multiple choice everything works fine, except of monocentric roles (I can attach more than one institute).

What is the reason for this "limitation"?
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

FILAMENT MANYTOMANY RELATIONSHIP ISSUE:
FilamentFFilament / ❓┊help
2y ago
ManyToMany Relationship on AttachAction
FilamentFFilament / ❓┊help
2y ago
Nested Resources with manyToMany relationship
FilamentFFilament / ❓┊help
2y ago
Select relationship
FilamentFFilament / ❓┊help
3y ago