my email unique validation is not working.
From this form, I am sending a user
<form id="edit-form" class="mt-4" action="{{ route('user.update', 1) }}" method="post">
@csrf @method('put')
</form>
It goes here to my web.php
Route::prefix('/user')->group(function () {
Route::put('/update/{user}', [AppHttpControllersUserController::class, 'update'])->name('user.update');
});
Then it comes here in the controller
public function update(UpdateUserRequest $request)
{
dd($request);
}
Which calls this request form:
public function rules(): array
{
return [
'email' => ['nullable', Rule::unique('users', 'email')->ignore($this->id, 'id'), 'email:rfc', 'max:255'],
];
}
Yet everytime, if I send the same email the model already has, it will say that the email is already in use.