| Total Complexity | 3 |
| Total Lines | 36 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 11 | class ApiController extends AdminController |
||
| 12 | { |
||
| 13 | protected function paginate($items, $perPage = 15, $pageStart = 1) |
||
| 19 | } |
||
| 20 | |||
| 21 | public function problems() |
||
| 22 | { |
||
| 23 | $q = request()->q; |
||
| 24 | |||
| 25 | return $this->paginate(Problem::orderBy('pcode', 'asc')->get()->filter(function ($problem) use ($q) { |
||
| 26 | return stripos($problem->readable_name, $q) !== false; |
||
| 27 | })->values()->transform(function ($problem) { |
||
| 28 | return [ |
||
| 29 | 'id' => $problem->pid, |
||
| 30 | 'text' => $problem->readable_name, |
||
| 31 | ]; |
||
| 32 | })->toArray()); |
||
| 33 | } |
||
| 34 | |||
| 35 | public function users() |
||
| 47 | } |
||
| 48 | } |
||
| 49 |