Beste Paginierung in der Laravel -API mit eloquent
#Best Pagination for Api's in laravel using eloquent
$billerCategories = BillerCategory::select('id', 'name', 'sp_key', 'category_order', 'sp_name', 'api_id', 'address_flag')->paginate(10);
return \Ipay::response([
'statusCode' => 'TXN',
'status' => 'Biller categories fetched successfully',
'data' => [
'meta' => [
'totalPages' => $billerCategories->lastPage(),
'currentPage' => $billerCategories->currentPage(),
'totalRecords' => $billerCategories->total(),
'recordsOnCurrentPage' => $billerCategories->count(),
'recordFrom' => $billerCategories->firstItem(),
'recordTo' => $billerCategories->lastItem(),
],
'records' => $billerCategories->items(),
],
]);
Tyagi420