diff --git a/src/Connection.php b/src/Connection.php index 17d7293..d6d1f0d 100644 --- a/src/Connection.php +++ b/src/Connection.php @@ -165,7 +165,7 @@ public function delete($query, $bindings = []) return $this->run( $query, $bindings, - Closure::fromCallable([$this->connection, 'delete']) + Closure::fromCallable([$this->connection, 'deleteByQuery']) ); } diff --git a/src/QueryBuilder.php b/src/QueryBuilder.php index 3cf0fcc..f6e2258 100644 --- a/src/QueryBuilder.php +++ b/src/QueryBuilder.php @@ -764,7 +764,7 @@ public function delete($id = null): bool $result = $this->connection->delete($this->grammar->compileDelete($this)); - return !empty($result['found']); + return !empty($result['deleted']); } public function __call($method, $parameters) diff --git a/src/QueryGrammar.php b/src/QueryGrammar.php index 38e913c..3719e67 100644 --- a/src/QueryGrammar.php +++ b/src/QueryGrammar.php @@ -1133,20 +1133,7 @@ public function compileInsert(Builder $builder, array $values): array */ public function compileDelete(Builder $builder): array { - $params = [ - 'index' => $builder->from . $this->indexSuffix, - 'id' => (string) $builder->wheres[0]['value'] - ]; - - if ($routing = $builder->getRouting()) { - $params['routing'] = $routing; - } - - if ($parentId = $builder->getParentId()) { - $params['parent'] = $parentId; - } - - return $params; + return $this->compileSelect($builder); } /**