code: public function whereExists(Closure $callback, $boolean = 'and', $not = false)
      {
          $type = $not ? 'NotExists' : 'Exists';
  
          $this->wheres[] = compact('type', 'callback', 'boolean');
  
          return $this;
      }
docs: either executed directly, or inserted into a larger query.