File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change 55use Illuminate \Support \Arr ;
66use Illuminate \Support \Str ;
77use Statamic \Contracts \Taxonomies \Term as TermContract ;
8+ use Statamic \Facades \Blink ;
89use Statamic \Facades \Collection ;
910use Statamic \Facades \Entry ;
1011use Statamic \Facades \Site ;
@@ -218,7 +219,14 @@ private function applyCollectionAndTaxonomyWheres()
218219 // or the ones associated with the collection
219220 // what we ultimately want is a subquery for terms in the form:
220221 // where('taxonomy', $taxonomy)->whereIn('slug', $slugArray)
221- Entry::whereInCollection ($ this ->collections )
222+ $ collectionTaxonomyHash = md5 (collect ($ this ->collections )->merge (collect ($ taxonomies ))->sort ()->join ('- ' ));
223+
224+ Blink::once ("eloquent-taxonomy-hash- {$ collectionTaxonomyHash }" , function () use ($ taxonomies ) {
225+ return Entry::query ()
226+ ->whereIn ('collection ' , $ this ->collections )
227+ ->select ($ taxonomies )
228+ ->get ();
229+ })
222230 ->flatMap (function ($ entry ) use ($ taxonomies ) {
223231 $ slugs = [];
224232 foreach ($ entry ->collection ()->taxonomies ()->map ->handle () as $ taxonomy ) {
You can’t perform that action at this time.
0 commit comments