if(Hash::check($request->old_password,$current_user->password)) code example

Example: if(Hash::check($request->old_password,$current_user->password))

return view('changepassword.changepassword', $data);    }    function updatepassword(Request $request)    {        //Validate requests        $request->validate([            'current_password'=>'required|min:6|max:50',            'new_password'=>'required|min:6|max:50',            'confirm_password'=>'required|min:6|max:50'        ]);        //$current_user =Login::where('password','=', $request->password);        $current_user=auth()->user();        if(Hash::check($request->old_password,$current_user->password))        {            $current_user->update([                'password'=>bcrypt($request->new_password)            ]);            return redirect()-> back()->with('success','Password successflly changed');        }        else        {            return back()->with('error','Old password dose not matched');        }        /*'current_password' => ['required', new MatchOldPassword],            'new_password' => ['required'],            'confirm_password' => ['same:new_password']        ]);

Tags:

Misc Example