@@ -6,7 +6,7 @@ |
||
6 | 6 | { |
7 | 7 | public function all($columns = ['*']) : Collection |
8 | 8 | { |
9 | - if (! $this->isCachable()) { |
|
9 | + if (!$this->isCachable()) { |
|
10 | 10 | $this->model->disableModelCaching(); |
11 | 11 | } |
12 | 12 |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | { |
13 | 13 | $option = $this->option('model'); |
14 | 14 | |
15 | - if (! $option) { |
|
15 | + if (!$option) { |
|
16 | 16 | return $this->flushEntireCache(); |
17 | 17 | } |
18 | 18 | |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | $usesCachableTrait = $this->getAllTraitsUsedByClass($option) |
37 | 37 | ->contains("GeneaLabs\LaravelModelCaching\Traits\Cachable"); |
38 | 38 | |
39 | - if (! $usesCachableTrait) { |
|
39 | + if (!$usesCachableTrait) { |
|
40 | 40 | $this->error("'{$option}' is not an instance of CachedModel."); |
41 | 41 | $this->line("Only CachedModel instances can be flushed."); |
42 | 42 |
@@ -9,7 +9,7 @@ |
||
9 | 9 | |
10 | 10 | public function boot() |
11 | 11 | { |
12 | - $configPath = __DIR__ . '/../../config/laravel-model-caching.php'; |
|
12 | + $configPath = __DIR__.'/../../config/laravel-model-caching.php'; |
|
13 | 13 | $this->mergeConfigFrom($configPath, 'laravel-model-caching'); |
14 | 14 | $this->commands(Clear::class); |
15 | 15 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | { |
29 | 29 | $tags = collect($this->eagerLoad) |
30 | 30 | ->keys() |
31 | - ->map(function ($relationName) { |
|
31 | + ->map(function($relationName) { |
|
32 | 32 | $relation = $this->getRelation($relationName); |
33 | 33 | |
34 | 34 | return $this->getCachePrefix() |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | protected function getRelation(string $relationName) : Relation |
54 | 54 | { |
55 | 55 | return collect(explode('.', $relationName)) |
56 | - ->reduce(function ($carry, $name) { |
|
56 | + ->reduce(function($carry, $name) { |
|
57 | 57 | $carry = $carry ?: $this->model; |
58 | 58 | $carry = $this->getRelatedModel($carry); |
59 | 59 |
@@ -52,8 +52,8 @@ discard block |
||
52 | 52 | |
53 | 53 | protected function getLimitClause() : string |
54 | 54 | { |
55 | - if (! property_exists($this->query, "limit") |
|
56 | - || ! $this->query->limit |
|
55 | + if (!property_exists($this->query, "limit") |
|
56 | + || !$this->query->limit |
|
57 | 57 | ) { |
58 | 58 | return ""; |
59 | 59 | } |
@@ -74,8 +74,8 @@ discard block |
||
74 | 74 | |
75 | 75 | protected function getOffsetClause() : string |
76 | 76 | { |
77 | - if (! property_exists($this->query, "offset") |
|
78 | - || ! $this->query->offset |
|
77 | + if (!property_exists($this->query, "offset") |
|
78 | + || !$this->query->offset |
|
79 | 79 | ) { |
80 | 80 | return ""; |
81 | 81 | } |
@@ -85,8 +85,8 @@ discard block |
||
85 | 85 | |
86 | 86 | protected function getOrderByClauses() : string |
87 | 87 | { |
88 | - if (! property_exists($this->query, "orders") |
|
89 | - || ! $this->query->orders |
|
88 | + if (!property_exists($this->query, "orders") |
|
89 | + || !$this->query->orders |
|
90 | 90 | ) { |
91 | 91 | return ""; |
92 | 92 | } |
@@ -94,12 +94,12 @@ discard block |
||
94 | 94 | $orders = collect($this->query->orders); |
95 | 95 | |
96 | 96 | return $orders |
97 | - ->reduce(function ($carry, $order) { |
|
97 | + ->reduce(function($carry, $order) { |
|
98 | 98 | if (($order["type"] ?? "") === "Raw") { |
99 | - return $carry . "_orderByRaw_" . (new Str)->slug($order["sql"]); |
|
99 | + return $carry."_orderByRaw_".(new Str)->slug($order["sql"]); |
|
100 | 100 | } |
101 | 101 | |
102 | - return $carry . "_orderBy_" . $order["column"] . "_" . $order["direction"]; |
|
102 | + return $carry."_orderBy_".$order["column"]."_".$order["direction"]; |
|
103 | 103 | }) |
104 | 104 | ?: ""; |
105 | 105 | } |
@@ -108,8 +108,8 @@ discard block |
||
108 | 108 | { |
109 | 109 | if (($columns === ["*"] |
110 | 110 | || $columns === []) |
111 | - && (! property_exists($this->query, "columns") |
|
112 | - || ! $this->query->columns) |
|
111 | + && (!property_exists($this->query, "columns") |
|
112 | + || !$this->query->columns) |
|
113 | 113 | ) { |
114 | 114 | return ""; |
115 | 115 | } |
@@ -117,10 +117,10 @@ discard block |
||
117 | 117 | if (property_exists($this->query, "columns") |
118 | 118 | && $this->query->columns |
119 | 119 | ) { |
120 | - return "_" . implode("_", $this->query->columns); |
|
120 | + return "_".implode("_", $this->query->columns); |
|
121 | 121 | } |
122 | 122 | |
123 | - return "_" . implode("_", $columns); |
|
123 | + return "_".implode("_", $columns); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | protected function getTypeClause($where) : string |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | |
135 | 135 | protected function getValuesClause(array $where = []) : string |
136 | 136 | { |
137 | - if (! $where |
|
137 | + if (!$where |
|
138 | 138 | || in_array($where["type"], ["NotNull", "Null"]) |
139 | 139 | ) { |
140 | 140 | return ""; |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | $values = $this->getValuesFromWhere($where); |
144 | 144 | $values = $this->getValuesFromBindings($where, $values); |
145 | 145 | |
146 | - return "_" . $values; |
|
146 | + return "_".$values; |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | protected function getValuesFromWhere(array $where) : string |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | $this->currentBinding++; |
163 | 163 | |
164 | 164 | if ($where["type"] === "between") { |
165 | - $values .= "_" . $this->query->bindings["where"][$this->currentBinding]; |
|
165 | + $values .= "_".$this->query->bindings["where"][$this->currentBinding]; |
|
166 | 166 | $this->currentBinding++; |
167 | 167 | } |
168 | 168 | } |
@@ -172,8 +172,8 @@ discard block |
||
172 | 172 | |
173 | 173 | protected function getWhereClauses(array $wheres = []) : string |
174 | 174 | { |
175 | - return "" . $this->getWheres($wheres) |
|
176 | - ->reduce(function ($carry, $where) { |
|
175 | + return "".$this->getWheres($wheres) |
|
176 | + ->reduce(function($carry, $where) { |
|
177 | 177 | $value = $carry; |
178 | 178 | $value .= $this->getNestedClauses($where); |
179 | 179 | $value .= $this->getColumnClauses($where); |
@@ -187,11 +187,11 @@ discard block |
||
187 | 187 | |
188 | 188 | protected function getNestedClauses(array $where) : string |
189 | 189 | { |
190 | - if (! in_array($where["type"], ["Exists", "Nested", "NotExists"])) { |
|
190 | + if (!in_array($where["type"], ["Exists", "Nested", "NotExists"])) { |
|
191 | 191 | return ""; |
192 | 192 | } |
193 | 193 | |
194 | - return "-" . strtolower($where["type"]) . $this->getWhereClauses($where["query"]->wheres); |
|
194 | + return "-".strtolower($where["type"]).$this->getWhereClauses($where["query"]->wheres); |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | protected function getColumnClauses(array $where) : string |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | |
206 | 206 | protected function getInAndNotInClauses(array $where) : string |
207 | 207 | { |
208 | - if (! in_array($where["type"], ["In", "NotIn", "InRaw"])) { |
|
208 | + if (!in_array($where["type"], ["In", "NotIn", "InRaw"])) { |
|
209 | 209 | return ""; |
210 | 210 | } |
211 | 211 | |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | continue; |
240 | 240 | } |
241 | 241 | |
242 | - $result .= $glue . $value; |
|
242 | + $result .= $glue.$value; |
|
243 | 243 | } |
244 | 244 | |
245 | 245 | return $result; |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | |
248 | 248 | protected function getRawClauses(array $where) : string |
249 | 249 | { |
250 | - if (! in_array($where["type"], ["raw"])) { |
|
250 | + if (!in_array($where["type"], ["raw"])) { |
|
251 | 251 | return ""; |
252 | 252 | } |
253 | 253 | |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | $clause = "_{$where["boolean"]}"; |
256 | 256 | |
257 | 257 | while (count($queryParts) > 1) { |
258 | - $clause .= "_" . array_shift($queryParts); |
|
258 | + $clause .= "_".array_shift($queryParts); |
|
259 | 259 | $clause .= $this->query->bindings["where"][$this->currentBinding]; |
260 | 260 | $this->currentBinding++; |
261 | 261 | } |
@@ -263,10 +263,10 @@ discard block |
||
263 | 263 | $lastPart = array_shift($queryParts); |
264 | 264 | |
265 | 265 | if ($lastPart) { |
266 | - $clause .= "_" . $lastPart; |
|
266 | + $clause .= "_".$lastPart; |
|
267 | 267 | } |
268 | 268 | |
269 | - return "-" . str_replace(" ", "_", $clause); |
|
269 | + return "-".str_replace(" ", "_", $clause); |
|
270 | 270 | } |
271 | 271 | |
272 | 272 | protected function getOtherClauses(array $where) : string |
@@ -302,8 +302,8 @@ discard block |
||
302 | 302 | return ""; |
303 | 303 | } |
304 | 304 | |
305 | - return $eagerLoads->keys()->reduce(function ($carry, $related) { |
|
306 | - if (! method_exists($this->model, $related)) { |
|
305 | + return $eagerLoads->keys()->reduce(function($carry, $related) { |
|
306 | + if (!method_exists($this->model, $related)) { |
|
307 | 307 | return "{$carry}-{$related}"; |
308 | 308 | } |
309 | 309 |
@@ -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,12 +270,12 @@ 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 | |
277 | 277 | return $this->isCachable |
278 | - && ! $isCacheDisabled; |
|
278 | + && !$isCacheDisabled; |
|
279 | 279 | } |
280 | 280 | |
281 | 281 | protected function setCacheCooldownSavedAtTimestamp(Model $instance) |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | $cacheKey = "{$cachePrefix}:{$modelClassName}-cooldown:saved-at"; |
286 | 286 | |
287 | 287 | $instance->cache() |
288 | - ->rememberForever($cacheKey, function () { |
|
288 | + ->rememberForever($cacheKey, function() { |
|
289 | 289 | return (new Carbon)->now(); |
290 | 290 | }); |
291 | 291 | } |
@@ -12,8 +12,8 @@ discard block |
||
12 | 12 | ->get("laravel-model-caching.use-database-keying"); |
13 | 13 | |
14 | 14 | if ($useDatabaseKeying) { |
15 | - $cachePrefix .= $this->getConnectionName() . ":"; |
|
16 | - $cachePrefix .= $this->getDatabaseName() . ":"; |
|
15 | + $cachePrefix .= $this->getConnectionName().":"; |
|
16 | + $cachePrefix .= $this->getDatabaseName().":"; |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | $cachePrefix .= Container::getInstance() |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | if ($this->model |
24 | 24 | && property_exists($this->model, "cachePrefix") |
25 | 25 | ) { |
26 | - $cachePrefix .= $this->model->cachePrefix . ":"; |
|
26 | + $cachePrefix .= $this->model->cachePrefix.":"; |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | return $cachePrefix; |
@@ -275,8 +275,8 @@ discard block |
||
275 | 275 | |
276 | 276 | $cache_callback = function () use ($arguments, $cacheKey, $method) { |
277 | 277 | return [ |
278 | - "key" => $cacheKey, |
|
279 | - "value" => parent::{$method}(...$arguments), |
|
278 | + "key" => $cacheKey, |
|
279 | + "value" => parent::{$method}(...$arguments), |
|
280 | 280 | ]; |
281 | 281 | }; |
282 | 282 | |
@@ -284,11 +284,11 @@ discard block |
||
284 | 284 | $this->checkCooldownAndRemoveIfExpired($this->getModel()); |
285 | 285 | if ($this->getModel()::maxCacheTimeout() > 0) { |
286 | 286 | return $this->cache($cacheTags) |
287 | - ->remember( |
|
287 | + ->remember( |
|
288 | 288 | $hashedCacheKey, |
289 | 289 | $this->getModel()::maxCacheTimeout(), |
290 | 290 | $cache_callback |
291 | - ); |
|
291 | + ); |
|
292 | 292 | } |
293 | 293 | } |
294 | 294 |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | { |
10 | 10 | public function avg($column) |
11 | 11 | { |
12 | - if (! $this->isCachable()) { |
|
12 | + if (!$this->isCachable()) { |
|
13 | 13 | return parent::avg($column); |
14 | 14 | } |
15 | 15 | |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | |
21 | 21 | public function count($columns = "*") |
22 | 22 | { |
23 | - if (! $this->isCachable()) { |
|
23 | + if (!$this->isCachable()) { |
|
24 | 24 | return parent::count($columns); |
25 | 25 | } |
26 | 26 | |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | */ |
51 | 51 | public function find($id, $columns = ["*"]) |
52 | 52 | { |
53 | - if (! $this->isCachable()) { |
|
53 | + if (!$this->isCachable()) { |
|
54 | 54 | return parent::find($id, $columns); |
55 | 55 | } |
56 | 56 | |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | |
67 | 67 | public function first($columns = ["*"]) |
68 | 68 | { |
69 | - if (! $this->isCachable()) { |
|
69 | + if (!$this->isCachable()) { |
|
70 | 70 | return parent::first($columns); |
71 | 71 | } |
72 | 72 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | |
86 | 86 | public function get($columns = ["*"]) |
87 | 87 | { |
88 | - if (! $this->isCachable()) { |
|
88 | + if (!$this->isCachable()) { |
|
89 | 89 | return parent::get($columns); |
90 | 90 | } |
91 | 91 | |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | |
119 | 119 | public function max($column) |
120 | 120 | { |
121 | - if (! $this->isCachable()) { |
|
121 | + if (!$this->isCachable()) { |
|
122 | 122 | return parent::max($column); |
123 | 123 | } |
124 | 124 | |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | |
130 | 130 | public function min($column) |
131 | 131 | { |
132 | - if (! $this->isCachable()) { |
|
132 | + if (!$this->isCachable()) { |
|
133 | 133 | return parent::min($column); |
134 | 134 | } |
135 | 135 | |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | $pageName = "page", |
145 | 145 | $page = null |
146 | 146 | ) { |
147 | - if (! $this->isCachable()) { |
|
147 | + if (!$this->isCachable()) { |
|
148 | 148 | return parent::paginate($perPage, $columns, $pageName, $page); |
149 | 149 | } |
150 | 150 | |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | $result = ""; |
168 | 168 | |
169 | 169 | foreach ($items as $key => $value) { |
170 | - $result .= $glue . $key . $glue . $value; |
|
170 | + $result .= $glue.$key.$glue.$value; |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | return $result; |
@@ -175,11 +175,11 @@ discard block |
||
175 | 175 | |
176 | 176 | public function pluck($column, $key = null) |
177 | 177 | { |
178 | - if (! $this->isCachable()) { |
|
178 | + if (!$this->isCachable()) { |
|
179 | 179 | return parent::pluck($column, $key); |
180 | 180 | } |
181 | 181 | |
182 | - $keyDifferentiator = "-pluck_{$column}" . ($key ? "_{$key}" : ""); |
|
182 | + $keyDifferentiator = "-pluck_{$column}".($key ? "_{$key}" : ""); |
|
183 | 183 | $cacheKey = $this->makeCacheKey([$column], null, $keyDifferentiator); |
184 | 184 | |
185 | 185 | return $this->cachedValue(func_get_args(), $cacheKey); |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | |
188 | 188 | public function sum($column) |
189 | 189 | { |
190 | - if (! $this->isCachable()) { |
|
190 | + if (!$this->isCachable()) { |
|
191 | 191 | return parent::sum($column); |
192 | 192 | } |
193 | 193 | |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | |
206 | 206 | public function value($column) |
207 | 207 | { |
208 | - if (! $this->isCachable()) { |
|
208 | + if (!$this->isCachable()) { |
|
209 | 209 | return parent::value($column); |
210 | 210 | } |
211 | 211 | |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | $this->checkCooldownAndRemoveIfExpired($this->model); |
274 | 274 | } |
275 | 275 | |
276 | - $cache_callback = function () use ($arguments, $cacheKey, $method) { |
|
276 | + $cache_callback = function() use ($arguments, $cacheKey, $method) { |
|
277 | 277 | return [ |
278 | 278 | "key" => $cacheKey, |
279 | 279 | "value" => parent::{$method}(...$arguments), |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | $tags = $instance->makeCacheTags(); |
59 | 59 | $key = $instance->makeCacheKey(); |
60 | 60 | |
61 | - $cache_callback = function () use ($columns) { |
|
61 | + $cache_callback = function() use ($columns) { |
|
62 | 62 | return parent::all($columns); |
63 | 63 | }; |
64 | 64 | |
@@ -77,15 +77,15 @@ discard block |
||
77 | 77 | |
78 | 78 | public static function bootCachable() |
79 | 79 | { |
80 | - static::created(function ($instance) { |
|
80 | + static::created(function($instance) { |
|
81 | 81 | $instance->checkCooldownAndFlushAfterPersisting($instance); |
82 | 82 | }); |
83 | 83 | |
84 | - static::deleted(function ($instance) { |
|
84 | + static::deleted(function($instance) { |
|
85 | 85 | $instance->checkCooldownAndFlushAfterPersisting($instance); |
86 | 86 | }); |
87 | 87 | |
88 | - static::saved(function ($instance) { |
|
88 | + static::saved(function($instance) { |
|
89 | 89 | $instance->checkCooldownAndFlushAfterPersisting($instance); |
90 | 90 | }); |
91 | 91 | |
@@ -94,15 +94,15 @@ discard block |
||
94 | 94 | // $instance->checkCooldownAndFlushAfterPersisting($instance); |
95 | 95 | // }); |
96 | 96 | |
97 | - static::pivotAttached(function ($instance, $secondInstance, $relationship) { |
|
97 | + static::pivotAttached(function($instance, $secondInstance, $relationship) { |
|
98 | 98 | $instance->checkCooldownAndFlushAfterPersisting($instance, $relationship); |
99 | 99 | }); |
100 | 100 | |
101 | - static::pivotDetached(function ($instance, $secondInstance, $relationship) { |
|
101 | + static::pivotDetached(function($instance, $secondInstance, $relationship) { |
|
102 | 102 | $instance->checkCooldownAndFlushAfterPersisting($instance, $relationship); |
103 | 103 | }); |
104 | 104 | |
105 | - static::pivotUpdated(function ($instance, $secondInstance, $relationship) { |
|
105 | + static::pivotUpdated(function($instance, $secondInstance, $relationship) { |
|
106 | 106 | $instance->checkCooldownAndFlushAfterPersisting($instance, $relationship); |
107 | 107 | }); |
108 | 108 | } |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | |
119 | 119 | public function newEloquentBuilder($query) |
120 | 120 | { |
121 | - if (! $this->isCachable()) { |
|
121 | + if (!$this->isCachable()) { |
|
122 | 122 | $this->isCachable = false; |
123 | 123 | |
124 | 124 | return new EloquentBuilder($query); |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | EloquentBuilder $query, |
178 | 178 | int $seconds = null |
179 | 179 | ) : EloquentBuilder { |
180 | - if (! $seconds) { |
|
180 | + if (!$seconds) { |
|
181 | 181 | $seconds = $this->cacheCooldownSeconds; |
182 | 182 | } |
183 | 183 | |
@@ -186,13 +186,13 @@ discard block |
||
186 | 186 | $cacheKey = "{$cachePrefix}:{$modelClassName}-cooldown:seconds"; |
187 | 187 | |
188 | 188 | $this->cache() |
189 | - ->rememberForever($cacheKey, function () use ($seconds) { |
|
189 | + ->rememberForever($cacheKey, function() use ($seconds) { |
|
190 | 190 | return $seconds; |
191 | 191 | }); |
192 | 192 | |
193 | 193 | $cacheKey = "{$cachePrefix}:{$modelClassName}-cooldown:invalidated-at"; |
194 | 194 | $this->cache() |
195 | - ->rememberForever($cacheKey, function () { |
|
195 | + ->rememberForever($cacheKey, function() { |
|
196 | 196 | return (new Carbon)->now(); |
197 | 197 | }); |
198 | 198 |