fix for bindings order when using where clause #127
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The bindings order were wrong. The following code includes published scope which is
$query->where('published_at', '<=', Carbon::now());
..$articles = Article::with('category')->published()->search($request->get('q'))->paginate(10);
params are:
0 2016-12-10 10:56:21
1 2016-12-10 10:56:21
2 test
3 test%
4 %test%
5 test
6 test%
7 %test%
which is wrong.
Correct Params should have been with this order :
My sql was like : (date and query params were at wrong places.)
select count() as aggregate from (select articles., max((case when LOWER(articles.title) LIKE '2016-12-10 10:56:21'' then 300 else 0 end) ..... bla bla bla.... having relevance > 7.50 order by relevance desc) as articles where published_at <= '%test%'
So made the changes. That fixed my issue for me . I am not sure if it breaks anything. So someone else should test it.
I am using laravel 5.3
have a good day.