Unique validation error on update
unique validation works during create but validation errors out during update.
I have two tables users and applicants the applicants belongsTo users and users hasOne applicants.
I have this form field for ApplicantResource's form
Forms\Components\TextInput::make('email')
->required()
->email()
->unique('users',ignoreRecord:true),
This works during creation of applicant in which i have. But during edit it errors out like this
Connection: mysql, SQL: select count(*) as aggregate from users where email = [email protected] and applicants.id <> 9)
here applicant_profiles.id = 9 i believe this is incorrect. applicants should be a table not a field.
I want to create and update user from applicant's form to.
4 Replies
https://filamentphp.com/docs/3.x/forms/validation#unique
You can specify the table, column, etc
does it make any difference??
Wont it automatically search in users table for email column
I tried what you suggested but same error none the less.
I think you are ignoring it in the users table, not in the applicants table...
I am using panel builder. I have two tables user and applicant. They have one to one realtionship. The user is parent and applicant is child. I want a single form from which i can modify user as well as applicant attributes. Here email is field in user table. During applicant creation i can create unique email users using the above rule but it doesn't work during update. Any suggestions how i should approach this
the email is in users table so shouldn't we ignore it there.