我在执行更改登录到系统的用户的密码的方法时遇到问题,因为它无法识别数组列来更改密码。错误是Attempt to read property "new_password" on array
。
dd($validations)
array:3 [▼ // app/Http/Controllers/ChangePasswordController.php:22
"current_password" => "12345."
"new_password" => "67890."
"confirm_new_password" => "67890."
]
method
public function updatePassword(ChangePasswordRequest $request)
{
$user = Auth::user()->name;
$validations = $request->validated();
User::find(Auth::user()->id)->update(['password'=> Hash::make($validations->new_password)]);
return redirect('change_password')->with('success-update-password',"$user changed your password with sucess.");
}
1条答案
按热度按时间lstz6jyr1#