public function updatePassword(Request $request)
    {
        $this->validate($request, [
            'old_password' => 'required',
            'password' => 'required|confirmed|max:6',
        ]);

        if (! Hash::check($request->old_password, Auth::user()->password)) {
            return response()->json(
                ['The old password you provided is incorrect.'], 422
            );
        }

        Auth::user()->password = Hash::make($request->password);

        Auth::user()->save();
    }
public function updatePassword(Request $request)
    {
        $this->validate($request, [
            'old_password' => 'required',
            'password' => 'required|confirmed|max:6',
        ]);

        if (! Hash::check($request->old_password, Auth::user()->password)) {
            return response()->json(
                ['The old password you provided is incorrect.'], 422
            );
        }

        Auth::user()->password = Hash::make($request->password);

        Auth::user()->save();
    }
public function updatePassword ( Request $ request ) { $ this -> validate ( $ request , [ 'old_password' => 'required' , 'password' => 'required|confirmed|max:6' , ] ) ; if ( ! Hash :: check ( $ request -> old_password , Auth :: user ( ) -> password ) ) { return response ( ) -> json ( [ 'The old password you provided is incorrect.' ] , 422 ) ; } Auth :: user ( ) -> password = Hash :: make ( $ request -> password ) ; Auth :: user ( ) -> save ( ) ; }
Update the user's password.

@param  \Illuminate\Http\Request  $request
@return \Illuminate\Http\Response
Update the user s password .