-
-
Notifications
You must be signed in to change notification settings - Fork 110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: Add the makeAllSearchableUsing API to the default import source #253
Conversation
this means that for each query this method will work, right? What do you think, adding it with a condition instead of applying for each query? |
Hi @hkulekci, the Searchable Trait already have the Thanks, and let me know anything :) |
hi @matchish any thoughts on this? :) |
Codecov ReportPatch coverage:
❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more. Additional details and impacted files@@ Coverage Diff @@
## master #253 +/- ##
============================================
+ Coverage 96.06% 96.08% +0.01%
Complexity 192 192
============================================
Files 36 36
Lines 636 639 +3
============================================
+ Hits 611 614 +3
Misses 25 25
☔ View full report in Codecov by Sentry. |
Hey) thanks for your effort to create the PR. Small improvement that should improve readability $query = $this->className::makeAllSearchableUsing($this->model()->newQuery());
$softDelete = $this->className::usesSoftDelete() && config('scout.soft_delete', false);
$query
->when($softDelete, function ($query) {
return $query->withTrashed();
})
->orderBy($this->model()->getQualifiedKeyName());
$scopes = $this->scopes; And could you add a test to cover the PR? |
Hi @matchish, I added a new Test, dont know if that was the right place, let me know. In order to add the Test I added a new This was the best way I found to make a test, I can't figure how to mock any existing model to assert if the method was called, so instead I added like this. Please let me know anything, all help is welcome. |
released |
In this PR I'm adding the handle of the method
makeAllSearchableUsing
in theDefaultImportSource
to allow/match this to the scout docs.https://laravel.com/docs/10.x/scout#modifying-the-import-query
I did this because I found a case where I needed to use the
makeAllSearchableUsing
method in a Model and found this was the easiest way to do it.