Skip to content

Commit

Permalink
Merge pull request #78 from designmynight/fix-on-search-connection
Browse files Browse the repository at this point in the history
fix: use passed model rather than `$this`
  • Loading branch information
Will Taylor-Jackson authored Jan 14, 2019
2 parents ffced2c + 0bcc832 commit 7e00eef
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Searchable.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit 7e00eef

Please sign in to comment.