Working with 1 to 1 relationship in filament panel builder.
I have 1 to 1 relationship between a user and applicant tables. User table has a unique email field. I need a single form for creating both applicant and user. So i created a applicant resource to create, update user and applicant. I used the rule ->TextField('emal')->email()->unique(table: User::class, ignoreRecord: True)
This works fine during create. I have overwritten the handleRecordCreation, mutateFormDataBeforeFill, handleRecordUpdate to create and update the respective tables.
But the unique validation will error out. It will try to search the applicant_id in users table as shown in error below
Connection: mysql, SQL: select count(*) as aggregate from users where email = [email protected] and applicants.id <> 9
How should i solve this problem?
Please or to participate in this conversation.