@@ -18,33 +18,33 @@ discard block |
||
| 18 | 18 | $key = $instance->makeCacheKey(); |
| 19 | 19 | |
| 20 | 20 | return $instance->cache($tags) |
| 21 | - ->rememberForever($key, function () use ($columns) { |
|
| 21 | + ->rememberForever($key, function() use ($columns) { |
|
| 22 | 22 | return parent::all($columns); |
| 23 | 23 | }); |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | public static function bootCachable() |
| 27 | 27 | { |
| 28 | - static::saved(function ($instance) { |
|
| 28 | + static::saved(function($instance) { |
|
| 29 | 29 | $instance->checkCooldownAndFlushAfterPersiting($instance); |
| 30 | 30 | }); |
| 31 | 31 | |
| 32 | - static::pivotAttached(function ($instance) { |
|
| 32 | + static::pivotAttached(function($instance) { |
|
| 33 | 33 | $instance->checkCooldownAndFlushAfterPersiting($instance); |
| 34 | 34 | }); |
| 35 | 35 | |
| 36 | - static::pivotDetached(function ($instance) { |
|
| 36 | + static::pivotDetached(function($instance) { |
|
| 37 | 37 | $instance->checkCooldownAndFlushAfterPersiting($instance); |
| 38 | 38 | }); |
| 39 | 39 | |
| 40 | - static::pivotUpdated(function ($instance) { |
|
| 40 | + static::pivotUpdated(function($instance) { |
|
| 41 | 41 | $instance->checkCooldownAndFlushAfterPersiting($instance); |
| 42 | 42 | }); |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | public function newEloquentBuilder($query) |
| 46 | 46 | { |
| 47 | - if (! $this->isCachable()) { |
|
| 47 | + if (!$this->isCachable()) { |
|
| 48 | 48 | $this->isCachable = true; |
| 49 | 49 | |
| 50 | 50 | return new EloquentBuilder($query); |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | public function scopeDisableCache(EloquentBuilder $query) : QueryOrModelCaller |
| 57 | 57 | { |
| 58 | - $disabledInConfig = config('laravel-model-caching.disabled'); |
|
| 58 | + $disabledInConfig = config('laravel-model-caching.disabled'); |
|
| 59 | 59 | |
| 60 | 60 | if ($this->isCachable()) { |
| 61 | 61 | config()->set('laravel-model-caching.disabled', true); |
@@ -74,13 +74,13 @@ discard block |
||
| 74 | 74 | $cacheKey = "{$cachePrefix}:{$modelClassName}-cooldown:seconds"; |
| 75 | 75 | |
| 76 | 76 | $this->cache() |
| 77 | - ->rememberForever($cacheKey, function () use ($seconds) { |
|
| 77 | + ->rememberForever($cacheKey, function() use ($seconds) { |
|
| 78 | 78 | return $seconds; |
| 79 | 79 | }); |
| 80 | 80 | |
| 81 | 81 | $cacheKey = "{$cachePrefix}:{$modelClassName}-cooldown:invalidated-at"; |
| 82 | 82 | $this->cache() |
| 83 | - ->rememberForever($cacheKey, function () { |
|
| 83 | + ->rememberForever($cacheKey, function() { |
|
| 84 | 84 | return now(); |
| 85 | 85 | }); |
| 86 | 86 | |
@@ -42,10 +42,11 @@ |
||
| 42 | 42 | */ |
| 43 | 43 | public function __call($name, $arguments) |
| 44 | 44 | { |
| 45 | - if ($name == 'all') |
|
| 46 | - $result = call_user_func_array([$this->model, 'all'], $arguments); |
|
| 47 | - else |
|
| 48 | - $result = call_user_func_array([$this->query, $name], $arguments); |
|
| 45 | + if ($name == 'all') { |
|
| 46 | + $result = call_user_func_array([$this->model, 'all'], $arguments); |
|
| 47 | + } else { |
|
| 48 | + $result = call_user_func_array([$this->query, $name], $arguments); |
|
| 49 | + } |
|
| 49 | 50 | |
| 50 | 51 | config()->set('laravel-model-caching.disabled', $this->disableInConfig); |
| 51 | 52 | |