F
Filament2mo ago
taz

unique rule from filament is case sensitive ?

public static function getForm(): array {
return [
Section::make()
->schema([
TextInput::make('name')
->label("Product Name")
->required()
->unique(table: Product::class, ignoreRecord: true)
->minLength(4)
->maxLength(30)
->autofocus(),
]),
public static function getForm(): array {
return [
Section::make()
->schema([
TextInput::make('name')
->label("Product Name")
->required()
->unique(table: Product::class, ignoreRecord: true)
->minLength(4)
->maxLength(30)
->autofocus(),
]),
I dont't know if it's a filament issue and how to fix it but I have a unique rule applied to the form field name. But the name "John" is considered similar to "john" and similar to "jóhn" I dont want that. Id like them to be considered different ! Thanks you . Filament is awesome btw!
1 Reply
DrByte
DrByte2mo ago
That is probably related to your database's character-set and that field's collation. For example if your collation is utf8_mb4_general_ci, the _ci part means case-insensitive, and in that scenario the database does internal pattern-matching to treat uppercase and lowercase "the same". In majority of situations this is desired. But if you have a certain field in your database that needs to be case-sensitive, you could explore using the _cs version of the same collation. Be sure to test from every angle though, as mixed-collations can cause problems with query-joins where both sides of the joining field use different collations (granted, most joins are on integer fields, not text). Worth exploring whether some database-specific factors are causing the problem you reported.
Want results from more Discord servers?
Add your server