diff --git a/Traits/QueryTrait.php b/Traits/QueryTrait.php index e24beb3..1aecb86 100644 --- a/Traits/QueryTrait.php +++ b/Traits/QueryTrait.php @@ -80,10 +80,10 @@ abstract class QueryTrait extends Component implements ActiveQueryInterface, ISq * * @return $this */ - public function whereNotExists(Closure|string $callback, array $attributes = []): static + public function whereNotExists(Closure|Query $callback, array $attributes = []): static { - if (is_string($callback)) { - $this->where[] = $callback; + if ($callback instanceof Query) { + $this->where[] = 'NOT EXISTS(' . $callback->build() . ')'; } else { $this->where[] = 'NOT EXISTS(' . $this->makeClosureFunction($callback) . ')'; }