I am using the rebing graphql laravel library and it works very fine returning json data. Currently I am trying to build a paginated table via reactjs frontend so I need to get a paginated data just the way it works normally with blade. I have used the paginate method in place of the get method but it somehow still gives same data format. This is what I have in my resolve method currently:
$models = YearModel
::with($with)
->select($select)
->where($where)
->orderByDesc('year_id');
if (isset($args['limit'])) {
$models = $models->paginate($args['limit']);
} else {
$models = $models->get();
}
return $models;
paginate and get returns same data to the frontend whereas I was expecting paginate to give some data which would include stuffs like currentPage, nextPage, previousPage as the LengthAwarePaginator class would normally do. So I believe the graphql library is somehow formating the paginated data as a normal data before returning it to the frontend. I am not sure why this is like this as I am new to graphql. Any idea or solution will be appreciated please. Thanks