@@ -27,6 +27,7 @@ trait QueryCacheable
2727 */
2828 public static function bootQueryCacheable ()
2929 {
30+ /** @var \Illuminate\Database\Eloquent\Model $this */
3031 if (isset (static ::$ flushCacheOnUpdate ) && static ::$ flushCacheOnUpdate ) {
3132 static ::observe (
3233 static ::getFlushQueryCacheObserver ()
@@ -69,6 +70,7 @@ protected function getCacheBaseTags(): array
6970 */
7071 public function getCacheTagsToInvalidateOnUpdate ($ relation = null , $ pivotedModels = null ): array
7172 {
73+ /** @var \Illuminate\Database\Eloquent\Model $this */
7274 return $ this ->getCacheBaseTags ();
7375 }
7476
@@ -77,6 +79,7 @@ public function getCacheTagsToInvalidateOnUpdate($relation = null, $pivotedModel
7779 */
7880 protected function newBaseQueryBuilder ()
7981 {
82+ /** @var \Illuminate\Database\Eloquent\Model $this */
8083 $ connection = $ this ->getConnection ();
8184
8285 $ builder = new Builder (
@@ -87,39 +90,39 @@ protected function newBaseQueryBuilder()
8790
8891 $ builder ->dontCache ();
8992
90- if ($ this -> cacheFor ) {
93+ if (property_exists ( $ this , ' cacheFor ' ) ) {
9194 $ builder ->cacheFor ($ this ->cacheFor );
9295 }
9396
9497 if (method_exists ($ this , 'cacheForValue ' )) {
9598 $ builder ->cacheFor ($ this ->cacheForValue ($ builder ));
9699 }
97100
98- if ($ this -> cacheTags ) {
101+ if (property_exists ( $ this , ' cacheTags ' ) ) {
99102 $ builder ->cacheTags ($ this ->cacheTags );
100103 }
101104
102105 if (method_exists ($ this , 'cacheTagsValue ' )) {
103106 $ builder ->cacheTags ($ this ->cacheTagsValue ($ builder ));
104107 }
105108
106- if ($ this -> cachePrefix ) {
109+ if (property_exists ( $ this , ' cachePrefix ' ) ) {
107110 $ builder ->cachePrefix ($ this ->cachePrefix );
108111 }
109112
110113 if (method_exists ($ this , 'cachePrefixValue ' )) {
111114 $ builder ->cachePrefix ($ this ->cachePrefixValue ($ builder ));
112115 }
113116
114- if ($ this -> cacheDriver ) {
117+ if (property_exists ( $ this , ' cacheDriver ' ) ) {
115118 $ builder ->cacheDriver ($ this ->cacheDriver );
116119 }
117120
118121 if (method_exists ($ this , 'cacheDriverValue ' )) {
119122 $ builder ->cacheDriver ($ this ->cacheDriverValue ($ builder ));
120123 }
121124
122- if ($ this -> cacheUsePlainKey ) {
125+ if (property_exists ( $ this , ' cacheUsePlainKey ' ) ) {
123126 $ builder ->withPlainKey ();
124127 }
125128
0 commit comments