© 2026 Hedgehog Software, LLC

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

Make row unique on 2 columns

I have a user_reports table that contains a user_id and report_name. I'm creating a select and I want each user to only have 1 entry for a given report, ie they should not have the same report listed twice for the same user.

I'm using a Relation Manager to achieve this, but when I add
->required()
->required()
to the field it won't allow me to create a record for a different user, shows a message saying 'The report has already been taken'.

Hoping this makes sense and someone can help with this.
Solution
As a stopgap, I've any options that are already used set as disabled in the select by using
->disableOptionWhen()
->disableOptionWhen()
and querying for the user and report name. This works as a stopgap as it's the only place in the application where a report can be added to a user but clearly not all that flexible and doesn't use the validation logic
Jump to solution
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

Unique Slug (2 Columns)
FilamentFFilament / ❓┊help
3y ago
Unique validation on 2 or more columns
FilamentFFilament / ❓┊help
12mo ago
Unique Multiple Columns
FilamentFFilament / ❓┊help
2y ago
unique multiple columns
FilamentFFilament / ❓┊help
3y ago