| @@ 69-78 (lines=10) @@ | ||
| 66 | ->toArray(); |
|
| 67 | } |
|
| 68 | ||
| 69 | public function avg($column) |
|
| 70 | { |
|
| 71 | $tags = [str_slug(get_class($this->model))]; |
|
| 72 | $key = str_slug(get_class($this->model)) ."-avg_{$column}"; |
|
| 73 | ||
| 74 | return $this->cache($tags) |
|
| 75 | ->rememberForever($key, function () use ($column) { |
|
| 76 | return parent::avg($column); |
|
| 77 | }); |
|
| 78 | } |
|
| 79 | ||
| 80 | public function count($columns = ['*']) |
|
| 81 | { |
|
| @@ 80-89 (lines=10) @@ | ||
| 77 | }); |
|
| 78 | } |
|
| 79 | ||
| 80 | public function count($columns = ['*']) |
|
| 81 | { |
|
| 82 | $tags = [str_slug(get_class($this->model))]; |
|
| 83 | $key = str_slug(get_class($this->model)) ."-count"; |
|
| 84 | ||
| 85 | return $this->cache($tags) |
|
| 86 | ->rememberForever($key, function () use ($columns) { |
|
| 87 | return parent::count($columns); |
|
| 88 | }); |
|
| 89 | } |
|
| 90 | ||
| 91 | public function cursor() |
|
| 92 | { |
|
| @@ 91-100 (lines=10) @@ | ||
| 88 | }); |
|
| 89 | } |
|
| 90 | ||
| 91 | public function cursor() |
|
| 92 | { |
|
| 93 | $tags = [str_slug(get_class($this->model))]; |
|
| 94 | $key = str_slug(get_class($this->model)) ."-cursor"; |
|
| 95 | ||
| 96 | return $this->cache($tags) |
|
| 97 | ->rememberForever($key, function () { |
|
| 98 | return collect(parent::cursor()); |
|
| 99 | }); |
|
| 100 | } |
|
| 101 | ||
| 102 | /** |
|
| 103 | * @SuppressWarnings(PHPMD.ShortVariable) |
|
| @@ 138-147 (lines=10) @@ | ||
| 135 | }); |
|
| 136 | } |
|
| 137 | ||
| 138 | public function max($column) |
|
| 139 | { |
|
| 140 | $tags = [str_slug(get_class($this->model))]; |
|
| 141 | $key = str_slug(get_class($this->model)) ."-max_{$column}"; |
|
| 142 | ||
| 143 | return $this->cache($tags) |
|
| 144 | ->rememberForever($key, function () use ($column) { |
|
| 145 | return parent::max($column); |
|
| 146 | }); |
|
| 147 | } |
|
| 148 | ||
| 149 | public function min($column) |
|
| 150 | { |
|
| @@ 149-158 (lines=10) @@ | ||
| 146 | }); |
|
| 147 | } |
|
| 148 | ||
| 149 | public function min($column) |
|
| 150 | { |
|
| 151 | $tags = [str_slug(get_class($this->model))]; |
|
| 152 | $key = str_slug(get_class($this->model)) ."-min_{$column}"; |
|
| 153 | ||
| 154 | return $this->cache($tags) |
|
| 155 | ->rememberForever($key, function () use ($column) { |
|
| 156 | return parent::min($column); |
|
| 157 | }); |
|
| 158 | } |
|
| 159 | ||
| 160 | public function pluck($column, $key = null) |
|
| 161 | { |
|
| @@ 175-184 (lines=10) @@ | ||
| 172 | }); |
|
| 173 | } |
|
| 174 | ||
| 175 | public function sum($column) |
|
| 176 | { |
|
| 177 | $tags = [str_slug(get_class($this->model))]; |
|
| 178 | $key = str_slug(get_class($this->model)) ."-sum_{$column}"; |
|
| 179 | ||
| 180 | return $this->cache($tags) |
|
| 181 | ->rememberForever($key, function () use ($column) { |
|
| 182 | return parent::sum($column); |
|
| 183 | }); |
|
| 184 | } |
|
| 185 | } |
|
| 186 | ||