@@ -10,21 +10,21 @@ discard block |
||
10 | 10 | |
11 | 11 | class ApiController extends AdminController |
12 | 12 | { |
13 | - protected function paginate($items, $perPage = 15, $pageStart = 1) |
|
13 | + protected function paginate($items, $perPage=15, $pageStart=1) |
|
14 | 14 | { |
15 | - $offSet = ($pageStart * $perPage) - $perPage; |
|
16 | - $itemsForCurrentPage = array_slice($items, $offSet, $perPage, true); |
|
17 | - $paginator = new LengthAwarePaginator($itemsForCurrentPage, count($items), $perPage, Paginator::resolveCurrentPage(), ['path' => Paginator::resolveCurrentPath()]); |
|
15 | + $offSet=($pageStart * $perPage)-$perPage; |
|
16 | + $itemsForCurrentPage=array_slice($items, $offSet, $perPage, true); |
|
17 | + $paginator=new LengthAwarePaginator($itemsForCurrentPage, count($items), $perPage, Paginator::resolveCurrentPage(), ['path' => Paginator::resolveCurrentPath()]); |
|
18 | 18 | return $paginator; |
19 | 19 | } |
20 | 20 | |
21 | 21 | public function problems() |
22 | 22 | { |
23 | - $q = request()->q; |
|
23 | + $q=request()->q; |
|
24 | 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) { |
|
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 | 28 | return [ |
29 | 29 | 'id' => $problem->pid, |
30 | 30 | 'text' => $problem->readable_name, |
@@ -34,11 +34,11 @@ discard block |
||
34 | 34 | |
35 | 35 | public function users() |
36 | 36 | { |
37 | - $q = request()->q; |
|
37 | + $q=request()->q; |
|
38 | 38 | |
39 | - return $this->paginate(User::get()->filter(function ($user) use ($q) { |
|
40 | - return stripos($user->readable_name, $q) !== false; |
|
41 | - })->values()->transform(function ($user) { |
|
39 | + return $this->paginate(User::get()->filter(function($user) use ($q) { |
|
40 | + return stripos($user->readable_name, $q)!==false; |
|
41 | + })->values()->transform(function($user) { |
|
42 | 42 | return [ |
43 | 43 | 'id' => $user->id, |
44 | 44 | 'text' => $user->readable_name, |