SkyCoder
2 months ago

How does fill update work with password field

Posted 2 months ago by SkyCoder

If I do

auth()->user()->fill([
  'password' => bcrypt(request('password'))
]);

It will make different hash and store new hash in database as new password since hashes won't match. I know this is not a big deal but should I still use fill or something like:

auth()->user()->password = request()->filled('password') && Hash::check(request('password'), auth()->user()->password) ? request('password') : auth()->user()->password ;

Please sign in or create an account to participate in this conversation.