That's my validation code:
'old_password' => 'max:255|required_with:new_password|old_password',
'new_password' => 'max:255|required_with:old_password|min:6|alpha_dash',
I've got alpha_dash and min:6 validation fails if both fields is empty. How can I fix it?
old_password is a custom rule
Validator::extend('old_password', function ($attribute, $value, $parameters, $validator) {
if( $value == ''){
return true;
} else {
return \Hash::check($value, request()->user()->password);
}
});
via fiter