| Conditions | 1 |
| Paths | 1 |
| Total Lines | 21 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 27 | public function index() |
||
| 28 | { |
||
| 29 | return \Cache::remember('achievements', 10, function () { |
||
| 30 | $achieveStorage = []; |
||
| 31 | |||
| 32 | (new Achieve()) |
||
|
|
|||
| 33 | ->selectRaw('name, count(user_id) as count') |
||
| 34 | ->groupBy('name') |
||
| 35 | ->get() |
||
| 36 | ->each(function ($item) use (&$achieveStorage) { |
||
| 37 | $achieveStorage[$item->name] = $item->count; |
||
| 38 | }); |
||
| 39 | |||
| 40 | return (new AchieveSubscriber()) |
||
| 41 | ->toCollection() |
||
| 42 | ->each(function (AbstractAchieve $achieve) use ($achieveStorage) { |
||
| 43 | $achieve->users = $achieveStorage[$achieve->name] ?? 0; |
||
| 44 | }) |
||
| 45 | ->toArray(); |
||
| 46 | }); |
||
| 47 | } |
||
| 48 | } |
This class, trait or interface has been deprecated.