File tree Expand file tree Collapse file tree 3 files changed +28
-0
lines changed
Integration/CachedBuilder Expand file tree Collapse file tree 3 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -164,6 +164,10 @@ protected function getValuesFromWhere(array $where) : string
164164 return implode ("_ " , collect ($ where ["values " ])->flatten ()->toArray ());
165165 }
166166
167+ if (is_array ((new Arr )->get ($ where , "value " ))) {
168+ return implode ("_ " , collect ($ where ["value " ])->flatten ()->toArray ());
169+ }
170+
167171 return (new Arr )->get ($ where , "value " , "" );
168172 }
169173
Original file line number Diff line number Diff line change @@ -49,4 +49,27 @@ public function testWithInUsingCollectionQuery()
4949 $ this ->assertEquals ($ liveResults ->pluck ("id " ), $ authors ->pluck ("id " ));
5050 $ this ->assertEquals ($ liveResults ->pluck ("id " ), $ cachedResults ->pluck ("id " ));
5151 }
52+
53+ public function testWithInUsingCollectionQueryWithArrayValues ()
54+ {
55+ $ key = sha1 ("genealabs:laravel-model-caching:pgsql:testing:authors:genealabslaravelmodelcachingtestsfixturesauthor-finances->tags_jsoncontains_[ \"foo \", \"bar \"]-authors.deleted_at_null " );
56+ $ tags = [
57+ 'genealabs:laravel-model-caching:pgsql:testing:genealabslaravelmodelcachingtestsfixturesauthor ' ,
58+ ];
59+
60+ $ authors = (new Author )
61+ ->whereJsonContains ("finances->tags " , ['foo ' , 'bar ' ])
62+ ->get ();
63+ $ liveResults = (new UncachedAuthor )
64+ ->whereJsonContains ("finances->tags " , ['foo ' , 'bar ' ])
65+ ->get ();
66+
67+ $ cachedResults = $ this
68+ ->cache ()
69+ ->tags ($ tags )
70+ ->get ($ key )['value ' ];
71+
72+ $ this ->assertEquals ($ liveResults ->pluck ("id " ), $ authors ->pluck ("id " ));
73+ $ this ->assertEquals ($ liveResults ->pluck ("id " ), $ cachedResults ->pluck ("id " ));
74+ }
5275}
Original file line number Diff line number Diff line change 1111 "total " => 5000 ,
1212 "weekly " => 100 ,
1313 "daily " => 20 ,
14+ 'tags ' => ['foo ' , 'bar ' ],
1415 ],
1516 "is_famous " => $ faker ->boolean (),
1617 ];
You can’t perform that action at this time.
0 commit comments