Skip to content

Commit c8db714

Browse files
committed
Revert "Remove redundant disabled-checks"
This reverts commit f354365.
1 parent 07c9b9f commit c8db714

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

src/CachedBuilder.php

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ class CachedBuilder extends EloquentBuilder
1212

1313
public function avg($column)
1414
{
15+
if (! $this->isCachable) {
16+
return parent::avg($column);
17+
}
18+
1519
$arguments = func_get_args();
1620
$cacheKey = $this->makeCacheKey(['*'], null, "-avg_{$column}");
1721
$method = 'avg';
@@ -21,6 +25,10 @@ public function avg($column)
2125

2226
public function count($columns = ['*'])
2327
{
28+
if (! $this->isCachable) {
29+
return parent::count($columns);
30+
}
31+
2432
$arguments = func_get_args();
2533
$cacheKey = $this->makeCacheKey(['*'], null, "-count");
2634
$method = 'count';
@@ -30,6 +38,10 @@ public function count($columns = ['*'])
3038

3139
public function cursor()
3240
{
41+
if (! $this->isCachable) {
42+
return collect(parent::cursor());
43+
}
44+
3345
$arguments = func_get_args();
3446
$cacheKey = $this->makeCacheKey(['*'], null, "-cursor");
3547
$method = 'cursor';
@@ -50,6 +62,10 @@ public function delete()
5062
*/
5163
public function find($id, $columns = ['*'])
5264
{
65+
if (! $this->isCachable) {
66+
return parent::find($id, $columns);
67+
}
68+
5369
$arguments = func_get_args();
5470
$cacheKey = $this->makeCacheKey($columns);
5571
$method = 'find';
@@ -59,6 +75,10 @@ public function find($id, $columns = ['*'])
5975

6076
public function first($columns = ['*'])
6177
{
78+
if (! $this->isCachable) {
79+
return parent::first($columns);
80+
}
81+
6282
$arguments = func_get_args();
6383
$cacheKey = $this->makeCacheKey($columns);
6484
$method = 'first';
@@ -68,6 +88,10 @@ public function first($columns = ['*'])
6888

6989
public function get($columns = ['*'])
7090
{
91+
if (! $this->isCachable) {
92+
return parent::get($columns);
93+
}
94+
7195
$arguments = func_get_args();
7296
$cacheKey = $this->makeCacheKey($columns);
7397
$method = 'get';
@@ -77,6 +101,10 @@ public function get($columns = ['*'])
77101

78102
public function max($column)
79103
{
104+
if (! $this->isCachable) {
105+
return parent::max($column);
106+
}
107+
80108
$arguments = func_get_args();
81109
$cacheKey = $this->makeCacheKey(['*'], null, "-max_{$column}");
82110
$method = 'max';
@@ -86,6 +114,10 @@ public function max($column)
86114

87115
public function min($column)
88116
{
117+
if (! $this->isCachable) {
118+
return parent::min($column);
119+
}
120+
89121
$arguments = func_get_args();
90122
$cacheKey = $this->makeCacheKey(['*'], null, "-min_{$column}");
91123
$method = 'min';
@@ -95,6 +127,10 @@ public function min($column)
95127

96128
public function pluck($column, $key = null)
97129
{
130+
if (! $this->isCachable) {
131+
return parent::pluck($column, $key);
132+
}
133+
98134
$keyDifferentiator = "-pluck_{$column}" . ($key ? "_{$key}" : "");
99135
$arguments = func_get_args();
100136
$cacheKey = $this->makeCacheKey([$column], null, $keyDifferentiator);
@@ -105,6 +141,10 @@ public function pluck($column, $key = null)
105141

106142
public function sum($column)
107143
{
144+
if (! $this->isCachable) {
145+
return parent::sum($column);
146+
}
147+
108148
$arguments = func_get_args();
109149
$cacheKey = $this->makeCacheKey(['*'], null, "-sum_{$column}");
110150
$method = 'sum';
@@ -114,6 +154,10 @@ public function sum($column)
114154

115155
public function value($column)
116156
{
157+
if (! $this->isCachable) {
158+
return parent::value($column);
159+
}
160+
117161
$arguments = func_get_args();
118162
$cacheKey = $this->makeCacheKey(['*'], null, "-value_{$column}");
119163
$method = 'value';

0 commit comments

Comments
 (0)