I made a similar thing just a few days ago - users can enter a new password and a password confirmation to change password, but they can also leave that field empty (and not change anything). I did this:
$rules["passwd_confirm"] = "required_with:passwd|same:passwd";
And if is passes validation, this snippet changes the password if needed
if(Input::get('passwd') != "") {
$user->password = Hash::make(Input::get('passwd'));
}
Hope this helps
I didn't need to use the validation rule as added confirm takes care of that but thanks i managed to get it working using your method.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community