更新ページを作成します。ユーザーは電子メールを変更できますが、パスワード確認が必要です。しかし、これに先立ち、現在の電子メールが正しいかどうか、新しい電子メールが保存可能かどうか、パスワードが正しいかどうかを確認するなどの検証が必要です。電子メールフィールドの更新と妥当性確認
しかし、私はこれが正しいかどうかを誰かに教えてもらえますか? (私はパットしたDDを気にしないでください、テストのためです)。
$user = Auth::user();
$this->validate($request, array(
'current_email' => 'required|email|unique:users,email,'. $user->id,
'email' => 'required|email|unique:users',
'verify_password' => 'required|min:6'
));
//Verify information user before updating
if($user->email != $request->current_email){
dd("Current Email is not the same");
}
if($user->password != bcrypt($request->verify_password)){
dd("Password incorrect, will not update");
}
dd("update, is ok now");
はthis.'する$ user-> validate'または 'ます$ this-> validate'を求めて私を気にしないのですか? –
@KelvinKyaw $ this-> validateは正しい構文です。 :) –
だから、あなたの 'validate()'関数はどこですか? –