diff --git a/src/Searchable.php b/src/Searchable.php index 8c24f4e..e3c694c 100644 --- a/src/Searchable.php +++ b/src/Searchable.php @@ -68,9 +68,9 @@ public function setKeysForSearch($query) public function addToIndex() { return $this->onSearchConnection(function ($model) { - $query = $model->setKeysForSaveQuery($this->newQueryWithoutScopes()); + $query = $model->setKeysForSaveQuery($model->newQueryWithoutScopes()); - $this->setKeysForSearch($query); + $model->setKeysForSearch($query); return $query->insert($model->toSearchableArray()); }, $this); @@ -94,9 +94,9 @@ public function updateIndex() public function removeFromIndex() { return $this->onSearchConnection(function ($model) { - $query = $model->setKeysForSaveQuery($this->newQueryWithoutScopes()); + $query = $model->setKeysForSaveQuery($model->newQueryWithoutScopes()); - $this->setKeysForSearch($query); + $model->setKeysForSearch($query); return $query->delete(); }, $this);