original_string: public function postUser()
      {
          $userData = array_filter(Binput::only(['username', 'email', 'password', 'google2fa']));
  
          $enable2FA = (bool) Arr::pull($userData, 'google2fa');
  
          // Let's enable/disable auth
          if ($enable2FA && !Auth::user()->hasTwoFactor) {
              event(new UserEnabledTwoAuthEvent(Auth::user()));
              $userData['google_2fa_secret'] = Google2FA::generateSecretKey();
          } elseif (!$enable2FA) {
              event(new UserDisabledTwoAuthEvent(Auth::user()));
              $userData['google_2fa_secret'] = '';
          }
  
          try {
              Auth::user()->update($userData);
          } catch (ValidationException $e) {
              return cachet_redirect('dashboard.user')
                  ->withInput($userData)
                  ->withTitle(sprintf('%s %s', trans('dashboard.notifications.whoops'), trans('dashboard.team.edit.failure')))
                  ->withErrors($e->getMessageBag());
          }
  
          return cachet_redirect('dashboard.user')
              ->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.team.edit.success')));
      }
code: public function postUser()
      {
          $userData = array_filter(Binput::only(['username', 'email', 'password', 'google2fa']));
  
          $enable2FA = (bool) Arr::pull($userData, 'google2fa');
  
          // Let's enable/disable auth
          if ($enable2FA && !Auth::user()->hasTwoFactor) {
              event(new UserEnabledTwoAuthEvent(Auth::user()));
              $userData['google_2fa_secret'] = Google2FA::generateSecretKey();
          } elseif (!$enable2FA) {
              event(new UserDisabledTwoAuthEvent(Auth::user()));
              $userData['google_2fa_secret'] = '';
          }
  
          try {
              Auth::user()->update($userData);
          } catch (ValidationException $e) {
              return cachet_redirect('dashboard.user')
                  ->withInput($userData)
                  ->withTitle(sprintf('%s %s', trans('dashboard.notifications.whoops'), trans('dashboard.team.edit.failure')))
                  ->withErrors($e->getMessageBag());
          }
  
          return cachet_redirect('dashboard.user')
              ->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.team.edit.success')));
      }
code_tokens: public function postUser ( ) { $ userData = array_filter ( Binput :: only ( [ 'username' , 'email' , 'password' , 'google2fa' ] ) ) ; $ enable2FA = ( bool ) Arr :: pull ( $ userData , 'google2fa' ) ; // Let's enable/disable auth if ( $ enable2FA && ! Auth :: user ( ) -> hasTwoFactor ) { event ( new UserEnabledTwoAuthEvent ( Auth :: user ( ) ) ) ; $ userData [ 'google_2fa_secret' ] = Google2FA :: generateSecretKey ( ) ; } elseif ( ! $ enable2FA ) { event ( new UserDisabledTwoAuthEvent ( Auth :: user ( ) ) ) ; $ userData [ 'google_2fa_secret' ] = '' ; } try { Auth :: user ( ) -> update ( $ userData ) ; } catch ( ValidationException $ e ) { return cachet_redirect ( 'dashboard.user' ) -> withInput ( $ userData ) -> withTitle ( sprintf ( '%s %s' , trans ( 'dashboard.notifications.whoops' ) , trans ( 'dashboard.team.edit.failure' ) ) ) -> withErrors ( $ e -> getMessageBag ( ) ) ; } return cachet_redirect ( 'dashboard.user' ) -> withSuccess ( sprintf ( '%s %s' , trans ( 'dashboard.notifications.awesome' ) , trans ( 'dashboard.team.edit.success' ) ) ) ; }
docstring: Updates the current user.
  
  @return \Illuminate\View\View
docstring_tokens: Updates the current user .