Action form not validating?

I thought form fields in this situation were validated automatically, but I'm getting an error SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '[email protected]' for key 'users.users_email_unique' Here's my form:
Action::make('Add Contact')
->button()
->color('secondary')
->form([
TextInput::make('first_name')->required()->rules('max:150'),
TextInput::make('last_name')->required()->rules('max:150'),
TextInput::make('email')->email()->required()->unique(ignorable: fn ($record) => $record),
TextInput::make('phone')->mask('(999) 999-9999')->tel(),
Select::make('role_id')->label('Role')->options(Role::all()->pluck('name', 'id'))->required()->searchable(),
])->action(function (array $data, Location $location): void {
$this->addContact($data, $location);
})->modalWidth('md')
Action::make('Add Contact')
->button()
->color('secondary')
->form([
TextInput::make('first_name')->required()->rules('max:150'),
TextInput::make('last_name')->required()->rules('max:150'),
TextInput::make('email')->email()->required()->unique(ignorable: fn ($record) => $record),
TextInput::make('phone')->mask('(999) 999-9999')->tel(),
Select::make('role_id')->label('Role')->options(Role::all()->pluck('name', 'id'))->required()->searchable(),
])->action(function (array $data, Location $location): void {
$this->addContact($data, $location);
})->modalWidth('md')
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server