@@ -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,7 +68,7 @@ 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(array $wheres = []) : string |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | $wheres = collect($this->query->wheres); |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - return $wheres->reduce(function ($carry, $where) { |
|
| 82 | + return $wheres->reduce(function($carry, $where) { |
|
| 83 | 83 | if (in_array($where['type'], ['Exists', 'Nested'])) { |
| 84 | 84 | return $this->getWhereClauses($where['query']->wheres); |
| 85 | 85 | } |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | if ($where['type'] === 'raw') { |
| 92 | - return "_{$where['boolean']}_" . str_slug($where['sql']); |
|
| 92 | + return "_{$where['boolean']}_".str_slug($where['sql']); |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | $value = array_get($where, 'value'); |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | if (is_array(array_get($where, 'values'))) { |
| 102 | - $value .= '_' . implode('_', $where['values']); |
|
| 102 | + $value .= '_'.implode('_', $where['values']); |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | return "{$carry}-{$where['column']}_{$value}"; |
@@ -114,16 +114,16 @@ discard block |
||
| 114 | 114 | return ''; |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | - return '-' . implode('-', $eagerLoads->keys()->toArray()); |
|
| 117 | + return '-'.implode('-', $eagerLoads->keys()->toArray()); |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | protected function getCacheTags() : array |
| 121 | 121 | { |
| 122 | 122 | return collect($this->eagerLoad)->keys() |
| 123 | - ->map(function ($relationName) { |
|
| 123 | + ->map(function($relationName) { |
|
| 124 | 124 | $relation = collect(explode('.', $relationName)) |
| 125 | - ->reduce(function ($carry, $name) { |
|
| 126 | - if (! $carry) { |
|
| 125 | + ->reduce(function($carry, $name) { |
|
| 126 | + if (!$carry) { |
|
| 127 | 127 | $carry = $this->model; |
| 128 | 128 | } |
| 129 | 129 | |
@@ -144,10 +144,10 @@ discard block |
||
| 144 | 144 | public function avg($column) |
| 145 | 145 | { |
| 146 | 146 | $tags = [str_slug(get_class($this->model))]; |
| 147 | - $key = str_slug(get_class($this->model)) ."-avg_{$column}"; |
|
| 147 | + $key = str_slug(get_class($this->model))."-avg_{$column}"; |
|
| 148 | 148 | |
| 149 | 149 | return $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 | } |
@@ -155,10 +155,10 @@ discard block |
||
| 155 | 155 | public function count($columns = ['*']) |
| 156 | 156 | { |
| 157 | 157 | $tags = [str_slug(get_class($this->model))]; |
| 158 | - $key = str_slug(get_class($this->model)) ."-count"; |
|
| 158 | + $key = str_slug(get_class($this->model))."-count"; |
|
| 159 | 159 | |
| 160 | 160 | return $this->cache($tags) |
| 161 | - ->rememberForever($key, function () use ($columns) { |
|
| 161 | + ->rememberForever($key, function() use ($columns) { |
|
| 162 | 162 | return parent::count($columns); |
| 163 | 163 | }); |
| 164 | 164 | } |
@@ -166,10 +166,10 @@ discard block |
||
| 166 | 166 | public function cursor() |
| 167 | 167 | { |
| 168 | 168 | $tags = [str_slug(get_class($this->model))]; |
| 169 | - $key = str_slug(get_class($this->model)) ."-cursor"; |
|
| 169 | + $key = str_slug(get_class($this->model))."-cursor"; |
|
| 170 | 170 | |
| 171 | 171 | return $this->cache($tags) |
| 172 | - ->rememberForever($key, function () { |
|
| 172 | + ->rememberForever($key, function() { |
|
| 173 | 173 | return collect(parent::cursor()); |
| 174 | 174 | }); |
| 175 | 175 | } |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | $key = $this->getCacheKey($columns, $id); |
| 184 | 184 | |
| 185 | 185 | return $this->cache($tags) |
| 186 | - ->rememberForever($key, function () use ($id, $columns) { |
|
| 186 | + ->rememberForever($key, function() use ($id, $columns) { |
|
| 187 | 187 | return parent::find($id, $columns); |
| 188 | 188 | }); |
| 189 | 189 | } |
@@ -191,10 +191,10 @@ discard block |
||
| 191 | 191 | public function first($columns = ['*']) |
| 192 | 192 | { |
| 193 | 193 | $tags = $this->getCacheTags(); |
| 194 | - $key = $this->getCacheKey($columns) . '-first'; |
|
| 194 | + $key = $this->getCacheKey($columns).'-first'; |
|
| 195 | 195 | |
| 196 | 196 | return $this->cache($tags) |
| 197 | - ->rememberForever($key, function () use ($columns) { |
|
| 197 | + ->rememberForever($key, function() use ($columns) { |
|
| 198 | 198 | return parent::first($columns); |
| 199 | 199 | }); |
| 200 | 200 | } |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | $key = $this->getCacheKey($columns); |
| 206 | 206 | |
| 207 | 207 | return $this->cache($tags) |
| 208 | - ->rememberForever($key, function () use ($columns) { |
|
| 208 | + ->rememberForever($key, function() use ($columns) { |
|
| 209 | 209 | return parent::get($columns); |
| 210 | 210 | }); |
| 211 | 211 | } |
@@ -213,10 +213,10 @@ discard block |
||
| 213 | 213 | public function max($column) |
| 214 | 214 | { |
| 215 | 215 | $tags = [str_slug(get_class($this->model))]; |
| 216 | - $key = str_slug(get_class($this->model)) ."-max_{$column}"; |
|
| 216 | + $key = str_slug(get_class($this->model))."-max_{$column}"; |
|
| 217 | 217 | |
| 218 | 218 | return $this->cache($tags) |
| 219 | - ->rememberForever($key, function () use ($column) { |
|
| 219 | + ->rememberForever($key, function() use ($column) { |
|
| 220 | 220 | return parent::max($column); |
| 221 | 221 | }); |
| 222 | 222 | } |
@@ -224,10 +224,10 @@ discard block |
||
| 224 | 224 | public function min($column) |
| 225 | 225 | { |
| 226 | 226 | $tags = [str_slug(get_class($this->model))]; |
| 227 | - $key = str_slug(get_class($this->model)) ."-min_{$column}"; |
|
| 227 | + $key = str_slug(get_class($this->model))."-min_{$column}"; |
|
| 228 | 228 | |
| 229 | 229 | return $this->cache($tags) |
| 230 | - ->rememberForever($key, function () use ($column) { |
|
| 230 | + ->rememberForever($key, function() use ($column) { |
|
| 231 | 231 | return parent::min($column); |
| 232 | 232 | }); |
| 233 | 233 | } |
@@ -235,14 +235,14 @@ discard block |
||
| 235 | 235 | public function pluck($column, $key = null) |
| 236 | 236 | { |
| 237 | 237 | $tags = $this->getCacheTags(); |
| 238 | - $cacheKey = $this->getCacheKey([$column]) . "-pluck_{$column}"; |
|
| 238 | + $cacheKey = $this->getCacheKey([$column])."-pluck_{$column}"; |
|
| 239 | 239 | |
| 240 | 240 | if ($key) { |
| 241 | 241 | $cacheKey .= "_{$key}"; |
| 242 | 242 | } |
| 243 | 243 | |
| 244 | 244 | return $this->cache($tags) |
| 245 | - ->rememberForever($cacheKey, function () use ($column, $key) { |
|
| 245 | + ->rememberForever($cacheKey, function() use ($column, $key) { |
|
| 246 | 246 | return parent::pluck($column, $key); |
| 247 | 247 | }); |
| 248 | 248 | } |
@@ -250,10 +250,10 @@ discard block |
||
| 250 | 250 | public function sum($column) |
| 251 | 251 | { |
| 252 | 252 | $tags = [str_slug(get_class($this->model))]; |
| 253 | - $key = str_slug(get_class($this->model)) ."-sum_{$column}"; |
|
| 253 | + $key = str_slug(get_class($this->model))."-sum_{$column}"; |
|
| 254 | 254 | |
| 255 | 255 | return $this->cache($tags) |
| 256 | - ->rememberForever($key, function () use ($column) { |
|
| 256 | + ->rememberForever($key, function() use ($column) { |
|
| 257 | 257 | return parent::sum($column); |
| 258 | 258 | }); |
| 259 | 259 | } |