Skip to content

Commit

Permalink
Merge pull request #85 from jarnovanleeuwen/master
Browse files Browse the repository at this point in the history
Added support for multiple connections.
  • Loading branch information
nicolaslopezj committed Oct 28, 2015
2 parents 14e70fc + 5be4386 commit 8d97d2c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/SearchableTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public function scopeSearchRestricted(Builder $q, $search, $restriction, $thresh
* @return array
*/
protected function getDatabaseDriver() {
$key = Config::get('database.default');
$key = $this->connection ?: Config::get('database.default');
return Config::get('database.connections.' . $key . '.driver');
}

Expand Down Expand Up @@ -291,7 +291,7 @@ protected function addBindingsToQuery(Builder $query, array $bindings) {
* @param \Illuminate\Database\Eloquent\Builder $original
*/
protected function mergeQueries(Builder $clone, Builder $original) {
$original->from(DB::raw("({$clone->toSql()}) as `{$this->getTable()}`"));
$original->from(DB::connection($this->connection)->raw("({$clone->toSql()}) as `{$this->getTable()}`"));
$original->mergeBindings($clone->getQuery());
}
}

0 comments on commit 8d97d2c

Please sign in to comment.