Skip to content

Commit c02b11e

Browse files
authored
Merge pull request #302 from titrxw/master
Unification of whether to turn on cache detection
2 parents 5cf2c86 + b2a8f20 commit c02b11e

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

src/Traits/ModelCaching.php

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,13 @@ public function __set($key, $value)
4040

4141
public static function all($columns = ['*'])
4242
{
43-
$cacheIsEnabled = Container::getInstance()
44-
->make("config")
45-
->get("laravel-model-caching.enabled");
46-
47-
if (! $cacheIsEnabled) {
48-
return parent::all($columns);
49-
}
50-
5143
$class = get_called_class();
5244
$instance = new $class;
45+
46+
if (!$instance->isCachable()) {
47+
return parent::all($columns);
48+
}
49+
5350
$tags = $instance->makeCacheTags();
5451
$key = $instance->makeCacheKey();
5552

0 commit comments

Comments
 (0)