public function changePassword(Request $request)
    {
        $this->validate(
            $request,
            [
                'old_password' => 'required',
                'new_password' => 'required|min:8',
            ]
        );

        if (!Hash::check($request->input('old_password'), Auth::user()->password)) {
            return redirect()->back()->withErrors([
                'old_password' => trans('mustard::account.password_incorrect'),
            ]);
        }

        if ($request->input('old_password') == $request->input('new_password')) {
            return redirect()->back()->withErrors([
                'new_password' => trans('mustard::account.password_same'),
            ]);
        }

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

        Auth::user()->save();

        Auth::user()->sendEmail(
            trans('mustard::account.password_changed'),
            'mustard::emails.account.password-changed'
        );

        return redirect()->back()->withStatus(trans('mustard::account.password_changed'));
    }
public function changePassword(Request $request)
    {
        $this->validate(
            $request,
            [
                'old_password' => 'required',
                'new_password' => 'required|min:8',
            ]
        );

        if (!Hash::check($request->input('old_password'), Auth::user()->password)) {
            return redirect()->back()->withErrors([
                'old_password' => trans('mustard::account.password_incorrect'),
            ]);
        }

        if ($request->input('old_password') == $request->input('new_password')) {
            return redirect()->back()->withErrors([
                'new_password' => trans('mustard::account.password_same'),
            ]);
        }

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

        Auth::user()->save();

        Auth::user()->sendEmail(
            trans('mustard::account.password_changed'),
            'mustard::emails.account.password-changed'
        );

        return redirect()->back()->withStatus(trans('mustard::account.password_changed'));
    }
public function changePassword ( Request $ request ) { $ this -> validate ( $ request , [ 'old_password' => 'required' , 'new_password' => 'required|min:8' , ] ) ; if ( ! Hash :: check ( $ request -> input ( 'old_password' ) , Auth :: user ( ) -> password ) ) { return redirect ( ) -> back ( ) -> withErrors ( [ 'old_password' => trans ( 'mustard::account.password_incorrect' ) , ] ) ; } if ( $ request -> input ( 'old_password' ) == $ request -> input ( 'new_password' ) ) { return redirect ( ) -> back ( ) -> withErrors ( [ 'new_password' => trans ( 'mustard::account.password_same' ) , ] ) ; } Auth :: user ( ) -> password = Hash :: make ( $ request -> input ( 'new_password' ) ) ; Auth :: user ( ) -> save ( ) ; Auth :: user ( ) -> sendEmail ( trans ( 'mustard::account.password_changed' ) , 'mustard::emails.account.password-changed' ) ; return redirect ( ) -> back ( ) -> withStatus ( trans ( 'mustard::account.password_changed' ) ) ; }
Change account password.

@return \Illuminate\Http\RedirectResponse
Change account password .