Skip to content

Comments

fix: case-insensitive validation for custom field options#72

Merged
ManukMinasyan merged 1 commit into3.xfrom
fix/case-insensitive-option-validation
Jan 29, 2026
Merged

fix: case-insensitive validation for custom field options#72
ManukMinasyan merged 1 commit into3.xfrom
fix/case-insensitive-option-validation

Conversation

@ManukMinasyan
Copy link
Collaborator

Replace Filament's distinct() with custom closure rule using Collection duplicates() for case-insensitive comparison. Prevents database unique constraint violations when adding options like "AB" and "ab".

Replace Filament's distinct() with custom closure rule using Collection
duplicates() for case-insensitive comparison. Prevents database unique
constraint violations when adding options like "AB" and "ab".
Copilot AI review requested due to automatic review settings January 29, 2026 20:37
@ManukMinasyan ManukMinasyan merged commit c037be8 into 3.x Jan 29, 2026
3 checks passed
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances validation for custom field options by implementing case-insensitive duplicate detection. The change prevents database unique constraint violations that would occur when users attempt to create options that differ only in case (e.g., "Active" and "active").

Changes:

  • Replaced Filament's built-in distinct() validation with a custom closure that performs case-insensitive comparison using Laravel Collection's duplicates() method
  • Added test coverage to verify case-insensitive validation works correctly

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/Filament/Management/Schemas/FieldForm.php Replaced distinct() with custom validation closure that uses mb_strtolower() and Collection duplicates() for case-insensitive duplicate detection
tests/Feature/Admin/Pages/CustomFieldsValidationTest.php Added test case to verify option names are validated as unique in a case-insensitive manner

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant