| @@ 144-153 (lines=10) @@ | ||
| 141 | ->toArray(); |
|
| 142 | } |
|
| 143 | ||
| 144 | public function avg($column) |
|
| 145 | { |
|
| 146 | $tags = [str_slug(get_class($this->model))]; |
|
| 147 | $key = str_slug(get_class($this->model)) ."-avg_{$column}"; |
|
| 148 | ||
| 149 | return $this->cache($tags) |
|
| 150 | ->rememberForever($key, function () use ($column) { |
|
| 151 | return parent::avg($column); |
|
| 152 | }); |
|
| 153 | } |
|
| 154 | ||
| 155 | public function count($columns = ['*']) |
|
| 156 | { |
|
| @@ 155-164 (lines=10) @@ | ||
| 152 | }); |
|
| 153 | } |
|
| 154 | ||
| 155 | public function count($columns = ['*']) |
|
| 156 | { |
|
| 157 | $tags = [str_slug(get_class($this->model))]; |
|
| 158 | $key = str_slug(get_class($this->model)) ."-count"; |
|
| 159 | ||
| 160 | return $this->cache($tags) |
|
| 161 | ->rememberForever($key, function () use ($columns) { |
|
| 162 | return parent::count($columns); |
|
| 163 | }); |
|
| 164 | } |
|
| 165 | ||
| 166 | public function cursor() |
|
| 167 | { |
|
| @@ 166-175 (lines=10) @@ | ||
| 163 | }); |
|
| 164 | } |
|
| 165 | ||
| 166 | public function cursor() |
|
| 167 | { |
|
| 168 | $tags = [str_slug(get_class($this->model))]; |
|
| 169 | $key = str_slug(get_class($this->model)) ."-cursor"; |
|
| 170 | ||
| 171 | return $this->cache($tags) |
|
| 172 | ->rememberForever($key, function () { |
|
| 173 | return collect(parent::cursor()); |
|
| 174 | }); |
|
| 175 | } |
|
| 176 | ||
| 177 | /** |
|
| 178 | * @SuppressWarnings(PHPMD.ShortVariable) |
|
| @@ 213-222 (lines=10) @@ | ||
| 210 | }); |
|
| 211 | } |
|
| 212 | ||
| 213 | public function max($column) |
|
| 214 | { |
|
| 215 | $tags = [str_slug(get_class($this->model))]; |
|
| 216 | $key = str_slug(get_class($this->model)) ."-max_{$column}"; |
|
| 217 | ||
| 218 | return $this->cache($tags) |
|
| 219 | ->rememberForever($key, function () use ($column) { |
|
| 220 | return parent::max($column); |
|
| 221 | }); |
|
| 222 | } |
|
| 223 | ||
| 224 | public function min($column) |
|
| 225 | { |
|
| @@ 224-233 (lines=10) @@ | ||
| 221 | }); |
|
| 222 | } |
|
| 223 | ||
| 224 | public function min($column) |
|
| 225 | { |
|
| 226 | $tags = [str_slug(get_class($this->model))]; |
|
| 227 | $key = str_slug(get_class($this->model)) ."-min_{$column}"; |
|
| 228 | ||
| 229 | return $this->cache($tags) |
|
| 230 | ->rememberForever($key, function () use ($column) { |
|
| 231 | return parent::min($column); |
|
| 232 | }); |
|
| 233 | } |
|
| 234 | ||
| 235 | public function pluck($column, $key = null) |
|
| 236 | { |
|
| @@ 250-259 (lines=10) @@ | ||
| 247 | }); |
|
| 248 | } |
|
| 249 | ||
| 250 | public function sum($column) |
|
| 251 | { |
|
| 252 | $tags = [str_slug(get_class($this->model))]; |
|
| 253 | $key = str_slug(get_class($this->model)) ."-sum_{$column}"; |
|
| 254 | ||
| 255 | return $this->cache($tags) |
|
| 256 | ->rememberForever($key, function () use ($column) { |
|
| 257 | return parent::sum($column); |
|
| 258 | }); |
|
| 259 | } |
|
| 260 | } |
|
| 261 | ||