@@ -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,21 +68,21 @@ 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 | 76 | // dump($this->query->wheres); |
| 77 | - return collect($this->query->wheres)->reduce(function ($carry, $where) { |
|
| 78 | - if (! $where['column'] ?? false) { |
|
| 79 | - return $carry . ''; |
|
| 77 | + return collect($this->query->wheres)->reduce(function($carry, $where) { |
|
| 78 | + if (!$where['column'] ?? false) { |
|
| 79 | + return $carry.''; |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | $value = $where['value'] ?? ''; |
| 83 | 83 | |
| 84 | 84 | if ($where['values'] ?? false) { |
| 85 | - $value .= 'in_' . implode('_', $where['values']); |
|
| 85 | + $value .= 'in_'.implode('_', $where['values']); |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | $value = $where['type'] === 'Null' ? 'null' : $value; |
@@ -99,16 +99,16 @@ discard block |
||
| 99 | 99 | return ''; |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | - return '-' . implode('-', $eagerLoads->keys()->toArray()); |
|
| 102 | + return '-'.implode('-', $eagerLoads->keys()->toArray()); |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | protected function getCacheTags() : array |
| 106 | 106 | { |
| 107 | 107 | return collect($this->eagerLoad)->keys() |
| 108 | - ->map(function ($relationName) { |
|
| 108 | + ->map(function($relationName) { |
|
| 109 | 109 | $relation = collect(explode('.', $relationName)) |
| 110 | - ->reduce(function ($carry, $name) { |
|
| 111 | - if (! $carry) { |
|
| 110 | + ->reduce(function($carry, $name) { |
|
| 111 | + if (!$carry) { |
|
| 112 | 112 | $carry = $this->model; |
| 113 | 113 | } |
| 114 | 114 | |
@@ -129,10 +129,10 @@ discard block |
||
| 129 | 129 | public function avg($column) |
| 130 | 130 | { |
| 131 | 131 | $tags = [str_slug(get_class($this->model))]; |
| 132 | - $key = str_slug(get_class($this->model)) ."-avg_{$column}"; |
|
| 132 | + $key = str_slug(get_class($this->model))."-avg_{$column}"; |
|
| 133 | 133 | |
| 134 | 134 | return $this->cache($tags) |
| 135 | - ->rememberForever($key, function () use ($column) { |
|
| 135 | + ->rememberForever($key, function() use ($column) { |
|
| 136 | 136 | return parent::avg($column); |
| 137 | 137 | }); |
| 138 | 138 | } |
@@ -140,10 +140,10 @@ discard block |
||
| 140 | 140 | public function count($columns = ['*']) |
| 141 | 141 | { |
| 142 | 142 | $tags = [str_slug(get_class($this->model))]; |
| 143 | - $key = str_slug(get_class($this->model)) ."-count"; |
|
| 143 | + $key = str_slug(get_class($this->model))."-count"; |
|
| 144 | 144 | |
| 145 | 145 | return $this->cache($tags) |
| 146 | - ->rememberForever($key, function () use ($columns) { |
|
| 146 | + ->rememberForever($key, function() use ($columns) { |
|
| 147 | 147 | return parent::count($columns); |
| 148 | 148 | }); |
| 149 | 149 | } |
@@ -151,10 +151,10 @@ discard block |
||
| 151 | 151 | public function cursor() |
| 152 | 152 | { |
| 153 | 153 | $tags = [str_slug(get_class($this->model))]; |
| 154 | - $key = str_slug(get_class($this->model)) ."-cursor"; |
|
| 154 | + $key = str_slug(get_class($this->model))."-cursor"; |
|
| 155 | 155 | |
| 156 | 156 | return $this->cache($tags) |
| 157 | - ->rememberForever($key, function () { |
|
| 157 | + ->rememberForever($key, function() { |
|
| 158 | 158 | return collect(parent::cursor()); |
| 159 | 159 | }); |
| 160 | 160 | } |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | $key = $this->getCacheKey($columns, $id); |
| 169 | 169 | |
| 170 | 170 | return $this->cache($tags) |
| 171 | - ->rememberForever($key, function () use ($id, $columns) { |
|
| 171 | + ->rememberForever($key, function() use ($id, $columns) { |
|
| 172 | 172 | return parent::find($id, $columns); |
| 173 | 173 | }); |
| 174 | 174 | } |
@@ -176,10 +176,10 @@ discard block |
||
| 176 | 176 | public function first($columns = ['*']) |
| 177 | 177 | { |
| 178 | 178 | $tags = $this->getCacheTags(); |
| 179 | - $key = $this->getCacheKey($columns) . '-first'; |
|
| 179 | + $key = $this->getCacheKey($columns).'-first'; |
|
| 180 | 180 | |
| 181 | 181 | return $this->cache($tags) |
| 182 | - ->rememberForever($key, function () use ($columns) { |
|
| 182 | + ->rememberForever($key, function() use ($columns) { |
|
| 183 | 183 | return parent::first($columns); |
| 184 | 184 | }); |
| 185 | 185 | } |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | $key = $this->getCacheKey($columns); |
| 191 | 191 | |
| 192 | 192 | return $this->cache($tags) |
| 193 | - ->rememberForever($key, function () use ($columns) { |
|
| 193 | + ->rememberForever($key, function() use ($columns) { |
|
| 194 | 194 | return parent::get($columns); |
| 195 | 195 | }); |
| 196 | 196 | } |
@@ -198,10 +198,10 @@ discard block |
||
| 198 | 198 | public function max($column) |
| 199 | 199 | { |
| 200 | 200 | $tags = [str_slug(get_class($this->model))]; |
| 201 | - $key = str_slug(get_class($this->model)) ."-max_{$column}"; |
|
| 201 | + $key = str_slug(get_class($this->model))."-max_{$column}"; |
|
| 202 | 202 | |
| 203 | 203 | return $this->cache($tags) |
| 204 | - ->rememberForever($key, function () use ($column) { |
|
| 204 | + ->rememberForever($key, function() use ($column) { |
|
| 205 | 205 | return parent::max($column); |
| 206 | 206 | }); |
| 207 | 207 | } |
@@ -209,10 +209,10 @@ discard block |
||
| 209 | 209 | public function min($column) |
| 210 | 210 | { |
| 211 | 211 | $tags = [str_slug(get_class($this->model))]; |
| 212 | - $key = str_slug(get_class($this->model)) ."-min_{$column}"; |
|
| 212 | + $key = str_slug(get_class($this->model))."-min_{$column}"; |
|
| 213 | 213 | |
| 214 | 214 | return $this->cache($tags) |
| 215 | - ->rememberForever($key, function () use ($column) { |
|
| 215 | + ->rememberForever($key, function() use ($column) { |
|
| 216 | 216 | return parent::min($column); |
| 217 | 217 | }); |
| 218 | 218 | } |
@@ -220,14 +220,14 @@ discard block |
||
| 220 | 220 | public function pluck($column, $key = null) |
| 221 | 221 | { |
| 222 | 222 | $tags = $this->getCacheTags(); |
| 223 | - $cacheKey = $this->getCacheKey([$column]) . "-pluck_{$column}"; |
|
| 223 | + $cacheKey = $this->getCacheKey([$column])."-pluck_{$column}"; |
|
| 224 | 224 | |
| 225 | 225 | if ($key) { |
| 226 | 226 | $cacheKey .= "_{$key}"; |
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | return $this->cache($tags) |
| 230 | - ->rememberForever($cacheKey, function () use ($column, $key) { |
|
| 230 | + ->rememberForever($cacheKey, function() use ($column, $key) { |
|
| 231 | 231 | return parent::pluck($column, $key); |
| 232 | 232 | }); |
| 233 | 233 | } |
@@ -235,10 +235,10 @@ discard block |
||
| 235 | 235 | public function sum($column) |
| 236 | 236 | { |
| 237 | 237 | $tags = [str_slug(get_class($this->model))]; |
| 238 | - $key = str_slug(get_class($this->model)) ."-sum_{$column}"; |
|
| 238 | + $key = str_slug(get_class($this->model))."-sum_{$column}"; |
|
| 239 | 239 | |
| 240 | 240 | return $this->cache($tags) |
| 241 | - ->rememberForever($key, function () use ($column) { |
|
| 241 | + ->rememberForever($key, function() use ($column) { |
|
| 242 | 242 | return parent::sum($column); |
| 243 | 243 | }); |
| 244 | 244 | } |