Skip to content

Commit 9a7675f

Browse files
committed
Add Laravel Paginators doc
1 parent 63d707f commit 9a7675f

File tree

2 files changed

+74
-1
lines changed

2 files changed

+74
-1
lines changed

docs/.vuepress/config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export default defineUserConfig({
3636
children: [
3737
'/guide/install.md',
3838
'/guide/quick-start.md',
39+
'/guide/laravel-paginators.md',
3940
],
4041
},
4142
{

docs/guide/laravel-paginators.md

Lines changed: 73 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,73 @@
1-
# Laravel Paginators
1+
# Laravel Paginators
2+
3+
This library supports the [JSON data structures](https://laravel.com/docs/9.x/pagination#converting-results-to-json) returned by Laravel's [`paginate()`](https://laravel.com/docs/9.x/pagination#paginating-query-builder-results) and [`simplePaginate()`](https://laravel.com/docs/9.x/pagination#simple-pagination) methods as well as Eloquent's [API Resource pagination](https://laravel.com/docs/9.x/eloquent-resources#pagination).
4+
5+
## paginate() example
6+
7+
```json
8+
{
9+
"current_page": 1,
10+
"data": [
11+
...
12+
],
13+
"first_page_url": "https://example.com/pagination?page=1",
14+
"from": 1,
15+
"last_page": 10,
16+
"last_page_url": "https://example.com/pagination?page=10",
17+
"links": [
18+
...
19+
],
20+
"next_page_url": "https://example.com/pagination?page=2",
21+
"path": "https://example.com/pagination",
22+
"per_page": 15,
23+
"prev_page_url": null,
24+
"to": 15,
25+
"total": 150
26+
}
27+
```
28+
29+
## simplePaginate() example
30+
31+
```json
32+
{
33+
"current_page": 1,
34+
"data": [
35+
...
36+
],
37+
"first_page_url": "https://example.com/pagination?page=1",
38+
"from": 1,
39+
"next_page_url": "https://example.com/pagination?page=2",
40+
"path": "https://example.com/pagination",
41+
"per_page": 15,
42+
"prev_page_url": null,
43+
"to": 15
44+
}
45+
```
46+
47+
## API Resource example
48+
49+
```json
50+
{
51+
"data": [
52+
...
53+
],
54+
"links": {
55+
"first": "https://example.com/pagination?page=1",
56+
"last": "https://example.com/pagination?page=10",
57+
"prev": null,
58+
"next": "https://example.com/pagination?page=2"
59+
},
60+
"meta": {
61+
"current_page": 1,
62+
"from": 1,
63+
"last_page": 10,
64+
"links": [
65+
...
66+
],
67+
"path": "https://example.com/pagination",
68+
"per_page": 15,
69+
"to": 15,
70+
"total": 150
71+
}
72+
}
73+
```

0 commit comments

Comments
 (0)