public function update(Request $request, $id)
    {
        if ($request->input('action') == 'update_account') {
            try {
                $this->userRepositoryInterface->update($request->all(), $id);
            } catch (FormValidationException $e) {
                Flash::error($e->getMessage());

                return redirect()
                  ->route('account.edit')
                  ->withErrors($e->getErrors())
                  ->withInput();
            } catch (UsersException $e) {
                Flash::error($e->getMessage());

                return redirect()->route('dashboard.index');
            }

            Flash::success(trans('dashboard::dashboard.flash.account.success'));

            return redirect()->route('account.edit');
        }

        if ($request->input('action') == 'change_password') {
            try {
                $this->userRepositoryInterface->updatePassword($request->all());
            } catch (FormValidationException $e) {
                Flash::error($e->getMessage());

                return redirect()
                  ->route('account.edit')
                  ->withErrors($e->getErrors());
            } catch (AuthenticationException $e) {
                Flash::error(trans('dashboard::dashboard.flash.password.fail'));

                return redirect()
                  ->route('account.edit');
            }

            Flash::success(trans('dashboard::dashboard.flash.password.success'));

            return redirect()->route('account.edit');
        }
    }
public function update(Request $request, $id)
    {
        if ($request->input('action') == 'update_account') {
            try {
                $this->userRepositoryInterface->update($request->all(), $id);
            } catch (FormValidationException $e) {
                Flash::error($e->getMessage());

                return redirect()
                  ->route('account.edit')
                  ->withErrors($e->getErrors())
                  ->withInput();
            } catch (UsersException $e) {
                Flash::error($e->getMessage());

                return redirect()->route('dashboard.index');
            }

            Flash::success(trans('dashboard::dashboard.flash.account.success'));

            return redirect()->route('account.edit');
        }

        if ($request->input('action') == 'change_password') {
            try {
                $this->userRepositoryInterface->updatePassword($request->all());
            } catch (FormValidationException $e) {
                Flash::error($e->getMessage());

                return redirect()
                  ->route('account.edit')
                  ->withErrors($e->getErrors());
            } catch (AuthenticationException $e) {
                Flash::error(trans('dashboard::dashboard.flash.password.fail'));

                return redirect()
                  ->route('account.edit');
            }

            Flash::success(trans('dashboard::dashboard.flash.password.success'));

            return redirect()->route('account.edit');
        }
    }
public function update ( Request $ request , $ id ) { if ( $ request -> input ( 'action' ) == 'update_account' ) { try { $ this -> userRepositoryInterface -> update ( $ request -> all ( ) , $ id ) ; } catch ( FormValidationException $ e ) { Flash :: error ( $ e -> getMessage ( ) ) ; return redirect ( ) -> route ( 'account.edit' ) -> withErrors ( $ e -> getErrors ( ) ) -> withInput ( ) ; } catch ( UsersException $ e ) { Flash :: error ( $ e -> getMessage ( ) ) ; return redirect ( ) -> route ( 'dashboard.index' ) ; } Flash :: success ( trans ( 'dashboard::dashboard.flash.account.success' ) ) ; return redirect ( ) -> route ( 'account.edit' ) ; } if ( $ request -> input ( 'action' ) == 'change_password' ) { try { $ this -> userRepositoryInterface -> updatePassword ( $ request -> all ( ) ) ; } catch ( FormValidationException $ e ) { Flash :: error ( $ e -> getMessage ( ) ) ; return redirect ( ) -> route ( 'account.edit' ) -> withErrors ( $ e -> getErrors ( ) ) ; } catch ( AuthenticationException $ e ) { Flash :: error ( trans ( 'dashboard::dashboard.flash.password.fail' ) ) ; return redirect ( ) -> route ( 'account.edit' ) ; } Flash :: success ( trans ( 'dashboard::dashboard.flash.password.success' ) ) ; return redirect ( ) -> route ( 'account.edit' ) ; } }
Update account information.

@param \Illuminate\Http\Request $request
@param                          $id

@return $this|\Illuminate\Http\RedirectResponse
Update account information .