| @@ 117-126 (lines=10) @@ | ||
| 114 | ->toArray(); |
|
| 115 | } |
|
| 116 | ||
| 117 | public function avg($column) |
|
| 118 | { |
|
| 119 | $tags = [str_slug(get_class($this->model))]; |
|
| 120 | $key = str_slug(get_class($this->model)) ."-avg_{$column}"; |
|
| 121 | ||
| 122 | return $this->cache($tags) |
|
| 123 | ->rememberForever($key, function () use ($column) { |
|
| 124 | return parent::avg($column); |
|
| 125 | }); |
|
| 126 | } |
|
| 127 | ||
| 128 | public function count($columns = ['*']) |
|
| 129 | { |
|
| @@ 128-137 (lines=10) @@ | ||
| 125 | }); |
|
| 126 | } |
|
| 127 | ||
| 128 | public function count($columns = ['*']) |
|
| 129 | { |
|
| 130 | $tags = [str_slug(get_class($this->model))]; |
|
| 131 | $key = str_slug(get_class($this->model)) ."-count"; |
|
| 132 | ||
| 133 | return $this->cache($tags) |
|
| 134 | ->rememberForever($key, function () use ($columns) { |
|
| 135 | return parent::count($columns); |
|
| 136 | }); |
|
| 137 | } |
|
| 138 | ||
| 139 | public function cursor() |
|
| 140 | { |
|
| @@ 139-148 (lines=10) @@ | ||
| 136 | }); |
|
| 137 | } |
|
| 138 | ||
| 139 | public function cursor() |
|
| 140 | { |
|
| 141 | $tags = [str_slug(get_class($this->model))]; |
|
| 142 | $key = str_slug(get_class($this->model)) ."-cursor"; |
|
| 143 | ||
| 144 | return $this->cache($tags) |
|
| 145 | ->rememberForever($key, function () { |
|
| 146 | return collect(parent::cursor()); |
|
| 147 | }); |
|
| 148 | } |
|
| 149 | ||
| 150 | /** |
|
| 151 | * @SuppressWarnings(PHPMD.ShortVariable) |
|
| @@ 186-195 (lines=10) @@ | ||
| 183 | }); |
|
| 184 | } |
|
| 185 | ||
| 186 | public function max($column) |
|
| 187 | { |
|
| 188 | $tags = [str_slug(get_class($this->model))]; |
|
| 189 | $key = str_slug(get_class($this->model)) ."-max_{$column}"; |
|
| 190 | ||
| 191 | return $this->cache($tags) |
|
| 192 | ->rememberForever($key, function () use ($column) { |
|
| 193 | return parent::max($column); |
|
| 194 | }); |
|
| 195 | } |
|
| 196 | ||
| 197 | public function min($column) |
|
| 198 | { |
|
| @@ 197-206 (lines=10) @@ | ||
| 194 | }); |
|
| 195 | } |
|
| 196 | ||
| 197 | public function min($column) |
|
| 198 | { |
|
| 199 | $tags = [str_slug(get_class($this->model))]; |
|
| 200 | $key = str_slug(get_class($this->model)) ."-min_{$column}"; |
|
| 201 | ||
| 202 | return $this->cache($tags) |
|
| 203 | ->rememberForever($key, function () use ($column) { |
|
| 204 | return parent::min($column); |
|
| 205 | }); |
|
| 206 | } |
|
| 207 | ||
| 208 | public function pluck($column, $key = null) |
|
| 209 | { |
|
| @@ 223-232 (lines=10) @@ | ||
| 220 | }); |
|
| 221 | } |
|
| 222 | ||
| 223 | public function sum($column) |
|
| 224 | { |
|
| 225 | $tags = [str_slug(get_class($this->model))]; |
|
| 226 | $key = str_slug(get_class($this->model)) ."-sum_{$column}"; |
|
| 227 | ||
| 228 | return $this->cache($tags) |
|
| 229 | ->rememberForever($key, function () use ($column) { |
|
| 230 | return parent::sum($column); |
|
| 231 | }); |
|
| 232 | } |
|
| 233 | } |
|
| 234 | ||