resetQuery method

void resetQuery()

Drops every clause accumulated so far, leaving the table, alias and connection in place so the builder can be reused for a fresh query.

A builder never clears itself after executing — paginate depends on that, since it runs count() and get() off the same clauses. But a builder that outlives one query (a Model held on a relation, say) would otherwise carry its old WHEREs into the next one.

Implementation

void resetQuery() {
  conditions.clear();
  bindings.clear();
  selectColumns = [];
  joins = [];
  unions = [];
}