Support the ongoing development of Laravel.io →
Authentication Input Eloquent
Last updated 2 years ago.
0

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

Last updated 2 years ago.
0

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.

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.