@@ -13,24 +13,24 @@ class CachedBuilder extends EloquentBuilder
1313
1414 public function avg ($ column )
1515 {
16- return $ this ->cache ($ this ->makeCacheTags ())
17- ->rememberForever ($ this ->makeCacheKey () . "-avg_ {$ column }" , function () use ($ column ) {
16+ return $ this ->cache ($ this ->makeCacheTags ($ this ))
17+ ->rememberForever ($ this ->makeCacheKey ($ this ) . "-avg_ {$ column }" , function () use ($ column ) {
1818 return parent ::avg ($ column );
1919 });
2020 }
2121
2222 public function count ($ columns = ['* ' ])
2323 {
24- return $ this ->cache ($ this ->makeCacheTags ())
25- ->rememberForever ($ this ->makeCacheKey () . "-count " , function () use ($ columns ) {
24+ return $ this ->cache ($ this ->makeCacheTags ($ this ))
25+ ->rememberForever ($ this ->makeCacheKey ($ this ) . "-count " , function () use ($ columns ) {
2626 return parent ::count ($ columns );
2727 });
2828 }
2929
3030 public function cursor ()
3131 {
32- return $ this ->cache ($ this ->makeCacheTags ())
33- ->rememberForever ($ this ->makeCacheKey () . "-cursor " , function () {
32+ return $ this ->cache ($ this ->makeCacheTags ($ this ))
33+ ->rememberForever ($ this ->makeCacheKey ($ this ) . "-cursor " , function () {
3434 return collect (parent ::cursor ());
3535 });
3636 }
@@ -40,62 +40,62 @@ public function cursor()
4040 */
4141 public function find ($ id , $ columns = ['* ' ])
4242 {
43- return $ this ->cache ($ this ->makeCacheTags ())
44- ->rememberForever ($ this ->makeCacheKey ($ columns , $ id ), function () use ($ id , $ columns ) {
43+ return $ this ->cache ($ this ->makeCacheTags ($ this ))
44+ ->rememberForever ($ this ->makeCacheKey ($ this , $ columns , $ id ), function () use ($ id , $ columns ) {
4545 return parent ::find ($ id , $ columns );
4646 });
4747 }
4848
4949 public function first ($ columns = ['* ' ])
5050 {
51- return $ this ->cache ($ this ->makeCacheTags ())
52- ->rememberForever ($ this ->makeCacheKey ($ columns ) . '-first ' , function () use ($ columns ) {
51+ return $ this ->cache ($ this ->makeCacheTags ($ this ))
52+ ->rememberForever ($ this ->makeCacheKey ($ this , $ columns ) . '-first ' , function () use ($ columns ) {
5353 return parent ::first ($ columns );
5454 });
5555 }
5656
5757 public function get ($ columns = ['* ' ])
5858 {
59- return $ this ->cache ($ this ->makeCacheTags ())
60- ->rememberForever ($ this ->makeCacheKey ($ columns ), function () use ($ columns ) {
59+ return $ this ->cache ($ this ->makeCacheTags ($ this ))
60+ ->rememberForever ($ this ->makeCacheKey ($ this , $ columns ), function () use ($ columns ) {
6161 return parent ::get ($ columns );
6262 });
6363 }
6464
6565 public function max ($ column )
6666 {
67- return $ this ->cache ($ this ->makeCacheTags ())
68- ->rememberForever ($ this ->makeCacheKey () . "-max_ {$ column }" , function () use ($ column ) {
67+ return $ this ->cache ($ this ->makeCacheTags ($ this ))
68+ ->rememberForever ($ this ->makeCacheKey ($ this ) . "-max_ {$ column }" , function () use ($ column ) {
6969 return parent ::max ($ column );
7070 });
7171 }
7272
7373 public function min ($ column )
7474 {
75- return $ this ->cache ($ this ->makeCacheTags ())
76- ->rememberForever ($ this ->makeCacheKey () . "-min_ {$ column }" , function () use ($ column ) {
75+ return $ this ->cache ($ this ->makeCacheTags ($ this ))
76+ ->rememberForever ($ this ->makeCacheKey ($ this ) . "-min_ {$ column }" , function () use ($ column ) {
7777 return parent ::min ($ column );
7878 });
7979 }
8080
8181 public function pluck ($ column , $ key = null )
8282 {
83- $ cacheKey = $ this ->makeCacheKey ([$ column ]) . "-pluck_ {$ column }" ;
83+ $ cacheKey = $ this ->makeCacheKey ($ this , [$ column ]) . "-pluck_ {$ column }" ;
8484
8585 if ($ key ) {
8686 $ cacheKey .= "_ {$ key }" ;
8787 }
8888
89- return $ this ->cache ($ this ->makeCacheTags ())
89+ return $ this ->cache ($ this ->makeCacheTags ($ this ))
9090 ->rememberForever ($ cacheKey , function () use ($ column , $ key ) {
9191 return parent ::pluck ($ column , $ key );
9292 });
9393 }
9494
9595 public function sum ($ column )
9696 {
97- return $ this ->cache ($ this ->makeCacheTags ())
98- ->rememberForever ($ this ->makeCacheKey () . "-sum_ {$ column }" , function () use ($ column ) {
97+ return $ this ->cache ($ this ->makeCacheTags ($ this ))
98+ ->rememberForever ($ this ->makeCacheKey ($ this ) . "-sum_ {$ column }" , function () use ($ column ) {
9999 return parent ::sum ($ column );
100100 });
101101 }
0 commit comments