Unique to check array field

'->unique(Employee::class, 'details.email_id') can we use array as a field'
7 Replies
Dan Harrin
Dan Harrin2y ago
i dont think laravel supports that no
Hemanath
HemanathOP2y ago
'Field::make('email')->unique(ignorable: $ignoredUser) how to use this in resources means what mention in the $ignoreduser,Sometimes, you may wish to ignore a given model during unique validation. For example, consider an "update profile" form that includes the user's name, email address, and location. You will probably want to verify that the email address is unique. However, if the user only changes the name field and not the email field, you do not want a validation error to be thrown because the user is already the owner of the email address in question'
Dan Harrin
Dan Harrin2y ago
instead try unique(ignoreRecord: true)
Hemanath
HemanathOP2y ago
okay 'I tired its coming but I need validation.unique can we customize it'
Dan Harrin
Dan Harrin2y ago
probably missing laravel validation translations in your /lang folder
ba_mbi_07
ba_mbi_072y ago
i used both this TextInput::make('slug') ->label('Kheltag Slug') ->unique(table: static::$model, ignorable: fn ($record) => $record) and ->unique(ignoreRecord: true) Both did not work
Dan Harrin
Dan Harrin2y ago
whats not working please open a new thread with information
Want results from more Discord servers?
Add your server