Skip to content

Commit

Permalink
Allows to change the builder implementation using the container
Browse files Browse the repository at this point in the history
  • Loading branch information
nunomaduro committed Nov 20, 2018
1 parent 6d59c01 commit 767de36
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Release Notes

## [v6.2.0 (unreleased)](https://github.com/laravel/scout/compare/v6.1.0...v6.2.0)
### Added
- Builder implementation can be changed using the container ([#322](https://github.com/laravel/scout/pull/322))

## [v6.1.0](https://github.com/laravel/scout/compare/v6.0.0...v6.1.0)

### Fixed
Expand Down
9 changes: 6 additions & 3 deletions src/Searchable.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,12 @@ public function shouldBeSearchable()
*/
public static function search($query = '', $callback = null)
{
return new Builder(
new static, $query, $callback, static::usesSoftDelete() && config('scout.soft_delete', false)
);
return app(Builder::class, [
'model' => new static,
'query' => $query,
'callback' => $callback,
'softDelete'=> static::usesSoftDelete() && config('scout.soft_delete', false)
]);
}

/**
Expand Down

0 comments on commit 767de36

Please sign in to comment.