@@ 153-162 (lines=10) @@ | ||
150 | ->toArray(); |
|
151 | } |
|
152 | ||
153 | public function avg($column) |
|
154 | { |
|
155 | $tags = [str_slug(get_class($this->model))]; |
|
156 | $key = str_slug(get_class($this->model)) ."-avg_{$column}"; |
|
157 | ||
158 | return $this->cache($tags) |
|
159 | ->rememberForever($key, function () use ($column) { |
|
160 | return parent::avg($column); |
|
161 | }); |
|
162 | } |
|
163 | ||
164 | public function count($columns = ['*']) |
|
165 | { |
|
@@ 164-173 (lines=10) @@ | ||
161 | }); |
|
162 | } |
|
163 | ||
164 | public function count($columns = ['*']) |
|
165 | { |
|
166 | $tags = [str_slug(get_class($this->model))]; |
|
167 | $key = str_slug(get_class($this->model)) ."-count"; |
|
168 | ||
169 | return $this->cache($tags) |
|
170 | ->rememberForever($key, function () use ($columns) { |
|
171 | return parent::count($columns); |
|
172 | }); |
|
173 | } |
|
174 | ||
175 | public function cursor() |
|
176 | { |
|
@@ 175-184 (lines=10) @@ | ||
172 | }); |
|
173 | } |
|
174 | ||
175 | public function cursor() |
|
176 | { |
|
177 | $tags = [str_slug(get_class($this->model))]; |
|
178 | $key = str_slug(get_class($this->model)) ."-cursor"; |
|
179 | ||
180 | return $this->cache($tags) |
|
181 | ->rememberForever($key, function () { |
|
182 | return collect(parent::cursor()); |
|
183 | }); |
|
184 | } |
|
185 | ||
186 | /** |
|
187 | * @SuppressWarnings(PHPMD.ShortVariable) |
|
@@ 222-231 (lines=10) @@ | ||
219 | }); |
|
220 | } |
|
221 | ||
222 | public function max($column) |
|
223 | { |
|
224 | $tags = [str_slug(get_class($this->model))]; |
|
225 | $key = str_slug(get_class($this->model)) ."-max_{$column}"; |
|
226 | ||
227 | return $this->cache($tags) |
|
228 | ->rememberForever($key, function () use ($column) { |
|
229 | return parent::max($column); |
|
230 | }); |
|
231 | } |
|
232 | ||
233 | public function min($column) |
|
234 | { |
|
@@ 233-242 (lines=10) @@ | ||
230 | }); |
|
231 | } |
|
232 | ||
233 | public function min($column) |
|
234 | { |
|
235 | $tags = [str_slug(get_class($this->model))]; |
|
236 | $key = str_slug(get_class($this->model)) ."-min_{$column}"; |
|
237 | ||
238 | return $this->cache($tags) |
|
239 | ->rememberForever($key, function () use ($column) { |
|
240 | return parent::min($column); |
|
241 | }); |
|
242 | } |
|
243 | ||
244 | public function pluck($column, $key = null) |
|
245 | { |
|
@@ 259-268 (lines=10) @@ | ||
256 | }); |
|
257 | } |
|
258 | ||
259 | public function sum($column) |
|
260 | { |
|
261 | $tags = [str_slug(get_class($this->model))]; |
|
262 | $key = str_slug(get_class($this->model)) ."-sum_{$column}"; |
|
263 | ||
264 | return $this->cache($tags) |
|
265 | ->rememberForever($key, function () use ($column) { |
|
266 | return parent::sum($column); |
|
267 | }); |
|
268 | } |
|
269 | } |
|
270 |