@@ -13,24 +13,24 @@ class CachedBuilder extends EloquentBuilder
13
13
14
14
public function avg ($ column )
15
15
{
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 ) {
18
18
return parent ::avg ($ column );
19
19
});
20
20
}
21
21
22
22
public function count ($ columns = ['* ' ])
23
23
{
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 ) {
26
26
return parent ::count ($ columns );
27
27
});
28
28
}
29
29
30
30
public function cursor ()
31
31
{
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 () {
34
34
return collect (parent ::cursor ());
35
35
});
36
36
}
@@ -40,62 +40,62 @@ public function cursor()
40
40
*/
41
41
public function find ($ id , $ columns = ['* ' ])
42
42
{
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 ) {
45
45
return parent ::find ($ id , $ columns );
46
46
});
47
47
}
48
48
49
49
public function first ($ columns = ['* ' ])
50
50
{
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 ) {
53
53
return parent ::first ($ columns );
54
54
});
55
55
}
56
56
57
57
public function get ($ columns = ['* ' ])
58
58
{
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 ) {
61
61
return parent ::get ($ columns );
62
62
});
63
63
}
64
64
65
65
public function max ($ column )
66
66
{
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 ) {
69
69
return parent ::max ($ column );
70
70
});
71
71
}
72
72
73
73
public function min ($ column )
74
74
{
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 ) {
77
77
return parent ::min ($ column );
78
78
});
79
79
}
80
80
81
81
public function pluck ($ column , $ key = null )
82
82
{
83
- $ cacheKey = $ this ->makeCacheKey ([$ column ]) . "-pluck_ {$ column }" ;
83
+ $ cacheKey = $ this ->makeCacheKey ($ this , [$ column ]) . "-pluck_ {$ column }" ;
84
84
85
85
if ($ key ) {
86
86
$ cacheKey .= "_ {$ key }" ;
87
87
}
88
88
89
- return $ this ->cache ($ this ->makeCacheTags ())
89
+ return $ this ->cache ($ this ->makeCacheTags ($ this ))
90
90
->rememberForever ($ cacheKey , function () use ($ column , $ key ) {
91
91
return parent ::pluck ($ column , $ key );
92
92
});
93
93
}
94
94
95
95
public function sum ($ column )
96
96
{
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 ) {
99
99
return parent ::sum ($ column );
100
100
});
101
101
}
0 commit comments