PaginationResponse<T>.fromLaravel constructor
PaginationResponse<T>.fromLaravel ()
Creates a PaginationResponse for Laravel-style pagination
This factory supports Laravel's paginate() response format:
{
"data": [...],
"current_page": 1,
"last_page": 10,
"per_page": 15,
"total": 150,
"from": 1,
"to": 15
}
Implementation
factory PaginationResponse.fromLaravel(
Map<String, dynamic> json,
T Function(Map<String, dynamic>) itemFromJson,
) {
return PaginationResponse.fromPageBased(
json,
itemFromJson,
dataKey: 'data',
currentPageKey: 'current_page',
lastPageKey: 'last_page',
perPageKey: 'per_page',
totalKey: 'total',
);
}