@@ -23,19 +23,19 @@ discard block |
||
| 23 | 23 | $class = get_called_class(); |
| 24 | 24 | $instance = new $class; |
| 25 | 25 | |
| 26 | - static::created(function () use ($instance) { |
|
| 26 | + static::created(function() use ($instance) { |
|
| 27 | 27 | $instance->flushCache(); |
| 28 | 28 | }); |
| 29 | 29 | |
| 30 | - static::deleted(function () use ($instance) { |
|
| 30 | + static::deleted(function() use ($instance) { |
|
| 31 | 31 | $instance->flushCache(); |
| 32 | 32 | }); |
| 33 | 33 | |
| 34 | - static::saved(function () use ($instance) { |
|
| 34 | + static::saved(function() use ($instance) { |
|
| 35 | 35 | $instance->flushCache(); |
| 36 | 36 | }); |
| 37 | 37 | |
| 38 | - static::updated(function () use ($instance) { |
|
| 38 | + static::updated(function() use ($instance) { |
|
| 39 | 39 | $instance->flushCache(); |
| 40 | 40 | }); |
| 41 | 41 | } |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | $key = 'genealabslaravelmodelcachingtestsfixturesauthor'; |
| 66 | 66 | |
| 67 | 67 | return $instance->cache($tags) |
| 68 | - ->rememberForever($key, function () use ($columns) { |
|
| 68 | + ->rememberForever($key, function() use ($columns) { |
|
| 69 | 69 | return parent::all($columns); |
| 70 | 70 | }); |
| 71 | 71 | } |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | protected function getLimitClause() : string |
| 43 | 43 | { |
| 44 | - if (! $this->query->limit) { |
|
| 44 | + if (!$this->query->limit) { |
|
| 45 | 45 | return ''; |
| 46 | 46 | } |
| 47 | 47 | |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | protected function getOffsetClause() : string |
| 57 | 57 | { |
| 58 | - if (! $this->query->offset) { |
|
| 58 | + if (!$this->query->offset) { |
|
| 59 | 59 | return ''; |
| 60 | 60 | } |
| 61 | 61 | |
@@ -68,12 +68,12 @@ discard block |
||
| 68 | 68 | return ''; |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - return '_' . implode('_', $columns); |
|
| 71 | + return '_'.implode('_', $columns); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | protected function getWhereClauses() : string |
| 75 | 75 | { |
| 76 | - return collect($this->query->wheres)->reduce(function ($carry, $where) { |
|
| 76 | + return collect($this->query->wheres)->reduce(function($carry, $where) { |
|
| 77 | 77 | $value = $where['value'] ?? implode('_', ($where['values'] ?? [])); |
| 78 | 78 | |
| 79 | 79 | return "{$carry}-{$where['column']}_{$value}"; |
@@ -88,16 +88,16 @@ discard block |
||
| 88 | 88 | return ''; |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - return '-' . implode('-', $eagerLoads->keys()->toArray()); |
|
| 91 | + return '-'.implode('-', $eagerLoads->keys()->toArray()); |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | protected function getCacheTags() : array |
| 95 | 95 | { |
| 96 | 96 | return collect($this->eagerLoad)->keys() |
| 97 | - ->map(function ($relationName) { |
|
| 97 | + ->map(function($relationName) { |
|
| 98 | 98 | $relation = collect(explode('.', $relationName)) |
| 99 | - ->reduce(function ($carry, $name) { |
|
| 100 | - if (! $carry) { |
|
| 99 | + ->reduce(function($carry, $name) { |
|
| 100 | + if (!$carry) { |
|
| 101 | 101 | $carry = $this->model; |
| 102 | 102 | } |
| 103 | 103 | |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | public function avg($column) |
| 140 | 140 | { |
| 141 | 141 | $tags = [str_slug(get_class($this->model))]; |
| 142 | - $key = str_slug(get_class($this->model)) ."-avg_{$column}"; |
|
| 142 | + $key = str_slug(get_class($this->model))."-avg_{$column}"; |
|
| 143 | 143 | |
| 144 | 144 | if ($this->isCaching()) { |
| 145 | 145 | return parent::avg($column); |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | |
| 148 | 148 | $cachingFlag = $this->setCachingFlag(); |
| 149 | 149 | $result = $this->cache($tags) |
| 150 | - ->rememberForever($key, function () use ($column) { |
|
| 150 | + ->rememberForever($key, function() use ($column) { |
|
| 151 | 151 | return parent::avg($column); |
| 152 | 152 | }); |
| 153 | 153 | $this->clearCachingFlag($cachingFlag); |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | public function count($columns = ['*']) |
| 159 | 159 | { |
| 160 | 160 | $tags = [str_slug(get_class($this->model))]; |
| 161 | - $key = str_slug(get_class($this->model)) ."-count"; |
|
| 161 | + $key = str_slug(get_class($this->model))."-count"; |
|
| 162 | 162 | |
| 163 | 163 | if ($this->isCaching()) { |
| 164 | 164 | return parent::count($columns); |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | |
| 167 | 167 | $cachingFlag = $this->setCachingFlag(); |
| 168 | 168 | $result = $this->cache($tags) |
| 169 | - ->rememberForever($key, function () use ($columns) { |
|
| 169 | + ->rememberForever($key, function() use ($columns) { |
|
| 170 | 170 | return parent::count($columns); |
| 171 | 171 | }); |
| 172 | 172 | $this->clearCachingFlag($cachingFlag); |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | public function cursor() |
| 178 | 178 | { |
| 179 | 179 | $tags = [str_slug(get_class($this->model))]; |
| 180 | - $key = str_slug(get_class($this->model)) ."-cursor"; |
|
| 180 | + $key = str_slug(get_class($this->model))."-cursor"; |
|
| 181 | 181 | |
| 182 | 182 | if ($this->isCaching()) { |
| 183 | 183 | return collect(parent::cursor()); |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | |
| 186 | 186 | $cachingFlag = $this->setCachingFlag(); |
| 187 | 187 | $result = $this->cache($tags) |
| 188 | - ->rememberForever($key, function () { |
|
| 188 | + ->rememberForever($key, function() { |
|
| 189 | 189 | return collect(parent::cursor()); |
| 190 | 190 | }); |
| 191 | 191 | $this->clearCachingFlag($cachingFlag); |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | |
| 208 | 208 | $cachingFlag = $this->setCachingFlag(); |
| 209 | 209 | $result = $this->cache($tags) |
| 210 | - ->rememberForever($key, function () use ($id, $columns) { |
|
| 210 | + ->rememberForever($key, function() use ($id, $columns) { |
|
| 211 | 211 | return parent::find($id, $columns); |
| 212 | 212 | }); |
| 213 | 213 | $this->clearCachingFlag($cachingFlag); |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | public function first($columns = ['*']) |
| 219 | 219 | { |
| 220 | 220 | $tags = $this->getCacheTags(); |
| 221 | - $key = $this->getCacheKey($columns) . '-first'; |
|
| 221 | + $key = $this->getCacheKey($columns).'-first'; |
|
| 222 | 222 | |
| 223 | 223 | if ($this->isCaching()) { |
| 224 | 224 | return parent::first($columns); |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | |
| 227 | 227 | $cachingFlag = $this->setCachingFlag(); |
| 228 | 228 | $result = $this->cache($tags) |
| 229 | - ->rememberForever($key, function () use ($columns) { |
|
| 229 | + ->rememberForever($key, function() use ($columns) { |
|
| 230 | 230 | return parent::first($columns); |
| 231 | 231 | }); |
| 232 | 232 | $this->clearCachingFlag($cachingFlag); |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | |
| 246 | 246 | $cachingFlag = $this->setCachingFlag(); |
| 247 | 247 | $result = $this->cache($tags) |
| 248 | - ->rememberForever($key, function () use ($columns) { |
|
| 248 | + ->rememberForever($key, function() use ($columns) { |
|
| 249 | 249 | return parent::get($columns); |
| 250 | 250 | }); |
| 251 | 251 | $this->clearCachingFlag($cachingFlag); |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | public function max($column) |
| 257 | 257 | { |
| 258 | 258 | $tags = [str_slug(get_class($this->model))]; |
| 259 | - $key = str_slug(get_class($this->model)) ."-max_{$column}"; |
|
| 259 | + $key = str_slug(get_class($this->model))."-max_{$column}"; |
|
| 260 | 260 | |
| 261 | 261 | if ($this->isCaching()) { |
| 262 | 262 | return parent::max($column); |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | |
| 265 | 265 | $cachingFlag = $this->setCachingFlag(); |
| 266 | 266 | $result = $this->cache($tags) |
| 267 | - ->rememberForever($key, function () use ($column) { |
|
| 267 | + ->rememberForever($key, function() use ($column) { |
|
| 268 | 268 | return parent::max($column); |
| 269 | 269 | }); |
| 270 | 270 | $this->clearCachingFlag($cachingFlag); |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | public function min($column) |
| 276 | 276 | { |
| 277 | 277 | $tags = [str_slug(get_class($this->model))]; |
| 278 | - $key = str_slug(get_class($this->model)) ."-min_{$column}"; |
|
| 278 | + $key = str_slug(get_class($this->model))."-min_{$column}"; |
|
| 279 | 279 | |
| 280 | 280 | if ($this->isCaching()) { |
| 281 | 281 | return parent::min($column); |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | |
| 284 | 284 | $cachingFlag = $this->setCachingFlag(); |
| 285 | 285 | $result = $this->cache($tags) |
| 286 | - ->rememberForever($key, function () use ($column) { |
|
| 286 | + ->rememberForever($key, function() use ($column) { |
|
| 287 | 287 | return parent::min($column); |
| 288 | 288 | }); |
| 289 | 289 | $this->clearCachingFlag($cachingFlag); |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | public function pluck($column, $key = null) |
| 295 | 295 | { |
| 296 | 296 | $tags = $this->getCacheTags(); |
| 297 | - $cacheKey = $this->getCacheKey([$column]) . "-pluck_{$column}"; |
|
| 297 | + $cacheKey = $this->getCacheKey([$column])."-pluck_{$column}"; |
|
| 298 | 298 | |
| 299 | 299 | if ($key) { |
| 300 | 300 | $cacheKey .= "_{$key}"; |
@@ -306,7 +306,7 @@ discard block |
||
| 306 | 306 | |
| 307 | 307 | $cachingFlag = $this->setCachingFlag(); |
| 308 | 308 | $result = $this->cache($tags) |
| 309 | - ->rememberForever($cacheKey, function () use ($column, $key) { |
|
| 309 | + ->rememberForever($cacheKey, function() use ($column, $key) { |
|
| 310 | 310 | return parent::pluck($column, $key); |
| 311 | 311 | }); |
| 312 | 312 | $this->clearCachingFlag($cachingFlag); |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | public function sum($column) |
| 318 | 318 | { |
| 319 | 319 | $tags = [str_slug(get_class($this->model))]; |
| 320 | - $key = str_slug(get_class($this->model)) ."-sum_{$column}"; |
|
| 320 | + $key = str_slug(get_class($this->model))."-sum_{$column}"; |
|
| 321 | 321 | |
| 322 | 322 | if ($this->isCaching()) { |
| 323 | 323 | return parent::sum($column); |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | |
| 326 | 326 | $cachingFlag = $this->setCachingFlag(); |
| 327 | 327 | $result = $this->cache($tags) |
| 328 | - ->rememberForever($key, function () use ($column) { |
|
| 328 | + ->rememberForever($key, function() use ($column) { |
|
| 329 | 329 | return parent::sum($column); |
| 330 | 330 | }); |
| 331 | 331 | $this->clearCachingFlag($cachingFlag); |