I am trying to add new error message in my validation if the user failed to input correct current password. Here is the code i am working on:
$validator = $this->validate($request, [
'current-password' => 'required',
'password' => 'required|string|min:6|confirmed',
]);
if (!(Hash::check($request->get('current-password'), Auth::user()->password))) {
$validator->errors()->add('current-password', 'Your current password does not matches with the password you provided. Please try again.');
}
I am getting this error when i submit the form: Call to a member function errors() on array
Any help would be appreciated. Thanks.