Skip to content

Commit 38b420c

Browse files
VeaceslavVeaceslav
authored andcommitted
Added pagination
1 parent e5a0650 commit 38b420c

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

app/Http/Controllers/API/CategoryController.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@
1414
class CategoryController extends Controller
1515
{
1616
/**
17+
* @param Request $request
1718
* @return JsonResponse
1819
*/
19-
public function index(): JsonResponse
20+
public function index(Request $request): JsonResponse
2021
{
21-
$categories = Category::GetListForUser()->get();
22+
$categories = Category::GetListForUser()
23+
->paginate($request->get('paginate') ?: '');
2224

2325
return new JsonResponse([
2426
'success' => true,

app/Http/Controllers/API/ProductController.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,13 @@
1515
class ProductController extends Controller
1616
{
1717
/**
18+
* @param Request $request
1819
* @return JsonResponse
1920
*/
20-
public function index(): JsonResponse
21+
public function index(Request $request): JsonResponse
2122
{
22-
$products = Product::GetListForUser()->get();
23+
$products = Product::GetListForUser()
24+
->paginate($request->get('paginate') ?: '');
2325

2426
return new JsonResponse([
2527
'success' => true,

0 commit comments

Comments
 (0)