Skip to content

Commit

Permalink
Merge pull request #169 from morphet81/master
Browse files Browse the repository at this point in the history
Fix bug #93 completing Tamrael's modification
  • Loading branch information
nicolaslopezj authored Jun 21, 2018
2 parents 831cf32 + e7abed4 commit 55b26c0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.DS_Store
13 changes: 8 additions & 5 deletions src/SearchableTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -322,11 +322,14 @@ protected function mergeQueries(Builder $clone, Builder $original) {
$original->from(DB::connection($this->connection)->raw("({$clone->toSql()}) as `{$tableName}`"));
}

$original->setBindings(
array_merge_recursive(
$clone->getBindings(),
$original->getBindings()
)
// First create a new array merging bindings
$mergedBindings = array_merge_recursive(
$clone->getBindings(),
$original->getBindings()
);

// Then apply bindings WITHOUT global scopes which are already included. If not, there is a strange behaviour
// with some scope's bindings remaning
$original->withoutGlobalScopes()->setBindings($mergedBindings);
}
}

0 comments on commit 55b26c0

Please sign in to comment.