Last active
September 2, 2019 04:29
-
-
Save 0xgdr/b4e583f7a02030f29b971b1ae7f2a593 to your computer and use it in GitHub Desktop.
Laravel manual paginator example.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // use Illuminate\Pagination\LengthAwarePaginator; | |
| $data = collect($matrixReportService->matrixReport($request)); | |
| $perPage = 5; | |
| $currentPage = LengthAwarePaginator::resolveCurrentPage(); | |
| $currentPageSearchResults = $data->slice(($currentPage - 1) * $perPage, $perPage)->all(); | |
| $entries = new LengthAwarePaginator($currentPageSearchResults, count($data), $perPage); | |
| return response()->json($data, 200) ; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment