@@ -27,6 +27,7 @@ trait QueryCacheable
27
27
*/
28
28
public static function bootQueryCacheable ()
29
29
{
30
+ /** @var \Illuminate\Database\Eloquent\Model $this */
30
31
if (isset (static ::$ flushCacheOnUpdate ) && static ::$ flushCacheOnUpdate ) {
31
32
static ::observe (
32
33
static ::getFlushQueryCacheObserver ()
@@ -69,6 +70,7 @@ protected function getCacheBaseTags(): array
69
70
*/
70
71
public function getCacheTagsToInvalidateOnUpdate ($ relation = null , $ pivotedModels = null ): array
71
72
{
73
+ /** @var \Illuminate\Database\Eloquent\Model $this */
72
74
return $ this ->getCacheBaseTags ();
73
75
}
74
76
@@ -77,6 +79,7 @@ public function getCacheTagsToInvalidateOnUpdate($relation = null, $pivotedModel
77
79
*/
78
80
protected function newBaseQueryBuilder ()
79
81
{
82
+ /** @var \Illuminate\Database\Eloquent\Model $this */
80
83
$ connection = $ this ->getConnection ();
81
84
82
85
$ builder = new Builder (
@@ -87,39 +90,39 @@ protected function newBaseQueryBuilder()
87
90
88
91
$ builder ->dontCache ();
89
92
90
- if ($ this -> cacheFor ) {
93
+ if (property_exists ( $ this , ' cacheFor ' ) ) {
91
94
$ builder ->cacheFor ($ this ->cacheFor );
92
95
}
93
96
94
97
if (method_exists ($ this , 'cacheForValue ' )) {
95
98
$ builder ->cacheFor ($ this ->cacheForValue ($ builder ));
96
99
}
97
100
98
- if ($ this -> cacheTags ) {
101
+ if (property_exists ( $ this , ' cacheTags ' ) ) {
99
102
$ builder ->cacheTags ($ this ->cacheTags );
100
103
}
101
104
102
105
if (method_exists ($ this , 'cacheTagsValue ' )) {
103
106
$ builder ->cacheTags ($ this ->cacheTagsValue ($ builder ));
104
107
}
105
108
106
- if ($ this -> cachePrefix ) {
109
+ if (property_exists ( $ this , ' cachePrefix ' ) ) {
107
110
$ builder ->cachePrefix ($ this ->cachePrefix );
108
111
}
109
112
110
113
if (method_exists ($ this , 'cachePrefixValue ' )) {
111
114
$ builder ->cachePrefix ($ this ->cachePrefixValue ($ builder ));
112
115
}
113
116
114
- if ($ this -> cacheDriver ) {
117
+ if (property_exists ( $ this , ' cacheDriver ' ) ) {
115
118
$ builder ->cacheDriver ($ this ->cacheDriver );
116
119
}
117
120
118
121
if (method_exists ($ this , 'cacheDriverValue ' )) {
119
122
$ builder ->cacheDriver ($ this ->cacheDriverValue ($ builder ));
120
123
}
121
124
122
- if ($ this -> cacheUsePlainKey ) {
125
+ if (property_exists ( $ this , ' cacheUsePlainKey ' ) ) {
123
126
$ builder ->withPlainKey ();
124
127
}
125
128
0 commit comments