app/Http/Controllers/ChangePassController.php
/**
     * User Password Change
     *
     * @param Request $request
     * @return void
     */
User Password Change
@param Request $request
@return void
User Password Change @param Request $request @return void
public function UpdatePassword(Request $request)
    {
        $validateData = $request->validate([
            'oldpassword' => 'required',
            'password' => 'required|confirmed',
        ]);
        $hashedPassword = Auth::user()->password;
        if(Hash::check($request->oldpassword, $hashedPassword)){
            $user = User::find(Auth::id());
            $user->password = Hash::make($request->password);
            $user->save();
            Auth::logout();
            return redirect()
                ->route('login')
                ->with('succes', 'Pasword Is Change Succesfuly');
        } else {
            return redirect()
                ->back()
                ->with('error', 'Current Pasword Is Invalid');
        }
    }
public function UpdatePassword ( Request $ request ) { $ validateData = $ request -> validate ( [ 'oldpassword' => 'required' , 'password' => 'required|confirmed' , ] ) ; $ hashedPassword = Auth :: user ( ) -> password ; if ( Hash :: check ( $ request -> oldpassword , $ hashedPassword ) ) { $ user = User :: find ( Auth :: id ( ) ) ; $ user -> password = Hash :: make ( $ request -> password ) ; $ user -> save ( ) ; Auth :: logout ( ) ; return redirect ( ) -> route ( 'login' ) -> with ( 'succes' , 'Pasword Is Change Succesfuly' ) ; } else { return redirect ( ) -> back ( ) -> with ( 'error' , 'Current Pasword Is Invalid' ) ; } }
User Password Change
 @param Request $request
 @return void
User Password Change @param Request $request @return void
// ログインユーザーと入力された古いパスワードをチェックする。