Skip to content

Commit

Permalink
Merge pull request #302 from titrxw/master
Browse files Browse the repository at this point in the history
Unification of whether to turn on cache detection
  • Loading branch information
mikebronner committed Dec 22, 2019
2 parents 5cf2c86 + b2a8f20 commit c02b11e
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/Traits/ModelCaching.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,13 @@ public function __set($key, $value)

public static function all($columns = ['*'])
{
$cacheIsEnabled = Container::getInstance()
->make("config")
->get("laravel-model-caching.enabled");

if (! $cacheIsEnabled) {
return parent::all($columns);
}

$class = get_called_class();
$instance = new $class;

if (!$instance->isCachable()) {
return parent::all($columns);
}

$tags = $instance->makeCacheTags();
$key = $instance->makeCacheKey();

Expand Down

0 comments on commit c02b11e

Please sign in to comment.