buildQuery($this->query)->$method(...$parameters); // If the result is a query builder, return $this to allow method chaining if ($result instanceof Query) { $this->query = $result; return $this; } // Otherwise return the result directly return $result; } }