@@ -34,18 +34,18 @@ discard block |
||
| 34 | 34 | |
| 35 | 35 | protected function applyScopesToInstance() |
| 36 | 36 | { |
| 37 | - if (! property_exists($this, "scopes") |
|
| 37 | + if (!property_exists($this, "scopes") |
|
| 38 | 38 | || $this->scopesAreApplied |
| 39 | 39 | ) { |
| 40 | 40 | return; |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | foreach ($this->scopes as $identifier => $scope) { |
| 44 | - if (! isset($this->scopes[$identifier])) { |
|
| 44 | + if (!isset($this->scopes[$identifier])) { |
|
| 45 | 45 | continue; |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - $this->callScope(function () use ($scope) { |
|
| 48 | + $this->callScope(function() use ($scope) { |
|
| 49 | 49 | if ($scope instanceof Closure) { |
| 50 | 50 | $scope($this); |
| 51 | 51 | } |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | $cacheKey = "{$cachePrefix}:{$modelClassName}-cooldown:saved-at"; |
| 104 | 104 | |
| 105 | 105 | $this->cache() |
| 106 | - ->rememberForever($cacheKey, function () { |
|
| 106 | + ->rememberForever($cacheKey, function() { |
|
| 107 | 107 | return (new Carbon)->now(); |
| 108 | 108 | }); |
| 109 | 109 | } |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | |
| 181 | 181 | public function getModelCacheCooldown(Model $instance) : array |
| 182 | 182 | { |
| 183 | - if (! $instance->cacheCooldownSeconds) { |
|
| 183 | + if (!$instance->cacheCooldownSeconds) { |
|
| 184 | 184 | return [null, null, null]; |
| 185 | 185 | } |
| 186 | 186 | |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | [$cacheCooldown, $invalidatedAt, $savedAt] = $this |
| 190 | 190 | ->getCacheCooldownDetails($instance, $cachePrefix, $modelClassName); |
| 191 | 191 | |
| 192 | - if (! $cacheCooldown || $cacheCooldown === 0) { |
|
| 192 | + if (!$cacheCooldown || $cacheCooldown === 0) { |
|
| 193 | 193 | return [null, null, null]; |
| 194 | 194 | } |
| 195 | 195 | |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | { |
| 219 | 219 | [$cacheCooldown, $invalidatedAt] = $this->getModelCacheCooldown($instance); |
| 220 | 220 | |
| 221 | - if (! $cacheCooldown |
|
| 221 | + if (!$cacheCooldown |
|
| 222 | 222 | || (new Carbon)->now()->diffInSeconds($invalidatedAt) < $cacheCooldown |
| 223 | 223 | ) { |
| 224 | 224 | return; |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | { |
| 244 | 244 | [$cacheCooldown, $invalidatedAt] = $instance->getModelCacheCooldown($instance); |
| 245 | 245 | |
| 246 | - if (! $cacheCooldown) { |
|
| 246 | + if (!$cacheCooldown) { |
|
| 247 | 247 | $instance->flushCache(); |
| 248 | 248 | |
| 249 | 249 | if ($relationship) { |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | |
| 271 | 271 | public function isCachable() : bool |
| 272 | 272 | { |
| 273 | - $isCacheDisabled = ! Container::getInstance() |
|
| 273 | + $isCacheDisabled = !Container::getInstance() |
|
| 274 | 274 | ->make("config") |
| 275 | 275 | ->get("laravel-model-caching.enabled"); |
| 276 | 276 | $allRelationshipsAreCachable = true; |
@@ -281,8 +281,8 @@ discard block |
||
| 281 | 281 | $allRelationshipsAreCachable = collect($this |
| 282 | 282 | ->eagerLoad) |
| 283 | 283 | ->keys() |
| 284 | - ->reduce(function ($carry, $related) { |
|
| 285 | - if (! method_exists($this, $related) |
|
| 284 | + ->reduce(function($carry, $related) { |
|
| 285 | + if (!method_exists($this, $related) |
|
| 286 | 286 | || $carry === false |
| 287 | 287 | ) { |
| 288 | 288 | return $carry; |
@@ -290,8 +290,8 @@ discard block |
||
| 290 | 290 | |
| 291 | 291 | $relatedModel = $this->model->$related()->getRelated(); |
| 292 | 292 | |
| 293 | - if (! method_exists($relatedModel, "isCachable") |
|
| 294 | - || ! $relatedModel->isCachable() |
|
| 293 | + if (!method_exists($relatedModel, "isCachable") |
|
| 294 | + || !$relatedModel->isCachable() |
|
| 295 | 295 | ) { |
| 296 | 296 | return false; |
| 297 | 297 | } |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | } |
| 303 | 303 | |
| 304 | 304 | return $this->isCachable |
| 305 | - && ! $isCacheDisabled |
|
| 305 | + && !$isCacheDisabled |
|
| 306 | 306 | && $allRelationshipsAreCachable; |
| 307 | 307 | } |
| 308 | 308 | |
@@ -313,7 +313,7 @@ discard block |
||
| 313 | 313 | $cacheKey = "{$cachePrefix}:{$modelClassName}-cooldown:saved-at"; |
| 314 | 314 | |
| 315 | 315 | $instance->cache() |
| 316 | - ->rememberForever($cacheKey, function () { |
|
| 316 | + ->rememberForever($cacheKey, function() { |
|
| 317 | 317 | return (new Carbon)->now(); |
| 318 | 318 | }); |
| 319 | 319 | } |