Open SuperDJ opened 3 years ago
The ->paginate() value is ignored:
->paginate()
When calling:
dd(Zoom::user() ->where( 'status', 'active' ) ->paginate( 10 )->get());
This is the result:
MacsiDigital\API\Support\ResultSet {#2651 ▼ #apiTotalRecords: 20 #apiPerPage: 10 #apiCurrentPage: 1 #apiLastPage: 2 #apiPagesDownloaded: array:1 [▶] #totalRecords: 20 #perPage: 50 #currentPage: 1 #lastPage: 1 #pagesDownloaded: array:1 [▶] #hasOwnMeta: true #paginationMethod: "fresh" #items: Illuminate\Support\Collection {#2672 ▶} #downloaded: 10 #raw: false #all: false #queries: 0 #maxQueries: "5" #builder: MacsiDigital\API\Support\Builder {#2315 ▶} #responses: array:1 [▶] #resource: MacsiDigital\Zoom\User {#2649 ▶} }
Now the result has 10 (downloaded) users but laravel thinks there are 50 (perPage). This is also a problem for JS components. For example the result in Vue looks like:
10
50
Also using ->setPerPage does not help. It still returns with perPage 50.
->setPerPage
perPage
$perPage = 10; return Zoom::user() ->where( 'status', 'active' ) ->paginate( $perPage ) ->setPerPage( $perPage ) ->get();
The
->paginate()
value is ignored:When calling:
This is the result:
Now the result has
10
(downloaded) users but laravel thinks there are50
(perPage). This is also a problem for JS components. For example the result in Vue looks like:Also using
->setPerPage
does not help. It still returns withperPage
50.