Skip to content

Commit

Permalink
Merge branch '3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Dec 7, 2017
2 parents 4c1a203 + 0d97152 commit 11d19af
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Searchable.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,13 @@ public static function makeAllSearchable()
{
$self = new static();

$softDeletes = in_array(SoftDeletes::class, class_uses_recursive(get_called_class())) &&
config('scout.soft_delete', false);

$self->newQuery()
->when($softDeletes, function ($query) {
$query->withTrashed();
})
->orderBy($self->getKeyName())
->searchable();
}
Expand Down
2 changes: 2 additions & 0 deletions tests/SearchableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ public function newQuery()
->andReturnSelf()
->shouldReceive('searchable');

$mock->shouldReceive('when')->andReturnSelf();

return $mock;
}
}
Expand Down

0 comments on commit 11d19af

Please sign in to comment.