Skip to content

Commit

Permalink
Get only approved reviews from the right store (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbclaudio authored Mar 9, 2023
1 parent 93f2d6d commit 960a8f2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Models/Scopes/WithReviewsScope.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@ public function apply(Builder $builder, Model $model)
->selectRaw('ANY_VALUE(review_entity_summary.reviews_count) AS reviews_count')
->leftJoin('review_entity_summary', function ($join) use ($model) {
$join->on($model->getTable().'.entity_id', '=', 'review_entity_summary.entity_pk_value')
->where('entity_type', 1);
->where('review_entity_summary.entity_type', 1)
->where('review_entity_summary.store_id', config('rapidez.store'));
})
->leftJoin('review', function ($join) {
$join->on('review_entity_summary.primary_id', '=', 'review.review_id')
->where('review.status_id', '1');
});
}
}

0 comments on commit 960a8f2

Please sign in to comment.