original_string: public function destroy(UserRemoverListener $listener, $id)
      {
          $user = Foundation::make('orchestra.user')->findOrFail($id);
  
          // Avoid self-deleting accident.
          if ((string) $user->id === (string) Auth::user()->id) {
              return $listener->selfDeletionFailed();
          }
  
          try {
              $this->fireEvent('deleting', [$user]);
  
              $user->transaction(function () use ($user) {
                  $user->delete();
              });
  
              $this->fireEvent('deleted', [$user]);
          } catch (Exception $e) {
              return $listener->userDeletionFailed(['error' => $e->getMessage()]);
          }
  
          return $listener->userDeleted();
      }
code: public function destroy(UserRemoverListener $listener, $id)
      {
          $user = Foundation::make('orchestra.user')->findOrFail($id);
  
          // Avoid self-deleting accident.
          if ((string) $user->id === (string) Auth::user()->id) {
              return $listener->selfDeletionFailed();
          }
  
          try {
              $this->fireEvent('deleting', [$user]);
  
              $user->transaction(function () use ($user) {
                  $user->delete();
              });
  
              $this->fireEvent('deleted', [$user]);
          } catch (Exception $e) {
              return $listener->userDeletionFailed(['error' => $e->getMessage()]);
          }
  
          return $listener->userDeleted();
      }
code_tokens: public function destroy ( UserRemoverListener $ listener , $ id ) { $ user = Foundation :: make ( 'orchestra.user' ) -> findOrFail ( $ id ) ; // Avoid self-deleting accident. if ( ( string ) $ user -> id === ( string ) Auth :: user ( ) -> id ) { return $ listener -> selfDeletionFailed ( ) ; } try { $ this -> fireEvent ( 'deleting' , [ $ user ] ) ; $ user -> transaction ( function ( ) use ( $ user ) { $ user -> delete ( ) ; } ) ; $ this -> fireEvent ( 'deleted' , [ $ user ] ) ; } catch ( Exception $ e ) { return $ listener -> userDeletionFailed ( [ 'error' => $ e -> getMessage ( ) ] ) ; } return $ listener -> userDeleted ( ) ; }
docstring: Destroy a user.
  
  @param  \Orchestra\Contracts\Foundation\Listener\Account\UserRemover  $listener
  @param  string|int  $id
  
  @return mixed
docstring_tokens: Destroy a user .