@@ -94,13 +94,13 @@ public function testDefaultPagination(): void
94
94
95
95
$ meta = [
96
96
'from ' => $ this ->encodeCursor (
97
- ["id " => (string ) $ posts [3 ]->getKey ()],
97
+ ["id " => (string ) $ posts [3 ]->getRouteKey ()],
98
98
pointsToNextItems: false ,
99
99
),
100
100
'hasMore ' => false ,
101
101
'perPage ' => 10 ,
102
102
'to ' => $ this ->encodeCursor (
103
- ["id " => (string ) $ posts [0 ]->getKey ()],
103
+ ["id " => (string ) $ posts [0 ]->getRouteKey ()],
104
104
pointsToNextItems: true ,
105
105
),
106
106
];
@@ -238,13 +238,13 @@ public function testWithoutCursor(): void
238
238
239
239
$ meta = [
240
240
'from ' => $ this ->encodeCursor (
241
- ["id " => (string ) $ posts [3 ]->getKey ()],
241
+ ["id " => (string ) $ posts [3 ]->getRouteKey ()],
242
242
pointsToNextItems: false ,
243
243
),
244
244
'hasMore ' => true ,
245
245
'perPage ' => 3 ,
246
246
'to ' => $ this ->encodeCursor (
247
- ["id " => (string ) $ posts [1 ]->getKey ()],
247
+ ["id " => (string ) $ posts [1 ]->getRouteKey ()],
248
248
pointsToNextItems: true ,
249
249
),
250
250
];
@@ -259,7 +259,7 @@ public function testWithoutCursor(): void
259
259
'href ' => 'http://localhost/api/v1/posts? ' . Arr::query ([
260
260
'page ' => [
261
261
'after ' => $ this ->encodeCursor (
262
- ["id " => (string ) $ posts [1 ]->getKey ()],
262
+ ["id " => (string ) $ posts [1 ]->getRouteKey ()],
263
263
pointsToNextItems: true ,
264
264
),
265
265
'limit ' => '3 ' ,
@@ -286,13 +286,13 @@ public function testWithAscending(): void
286
286
287
287
$ meta = [
288
288
'from ' => $ this ->encodeCursor (
289
- ["id " => (string ) $ posts [0 ]->getKey ()],
289
+ ["id " => (string ) $ posts [0 ]->getRouteKey ()],
290
290
pointsToNextItems: false ,
291
291
),
292
292
'hasMore ' => true ,
293
293
'perPage ' => 3 ,
294
294
'to ' => $ this ->encodeCursor (
295
- ["id " => (string ) $ posts [2 ]->getKey ()],
295
+ ["id " => (string ) $ posts [2 ]->getRouteKey ()],
296
296
pointsToNextItems: true ,
297
297
),
298
298
];
@@ -307,7 +307,7 @@ public function testWithAscending(): void
307
307
'href ' => 'http://localhost/api/v1/posts? ' . Arr::query ([
308
308
'page ' => [
309
309
'after ' => $ this ->encodeCursor (
310
- ["id " => (string ) $ posts [2 ]->getKey ()],
310
+ ["id " => (string ) $ posts [2 ]->getRouteKey ()],
311
311
pointsToNextItems: true ,
312
312
),
313
313
'limit ' => '3 ' ,
@@ -334,13 +334,13 @@ public function testAfter(): void
334
334
335
335
$ meta = [
336
336
'from ' => $ this ->encodeCursor (
337
- ["id " => (string ) $ posts [0 ]->getKey ()],
337
+ ["id " => (string ) $ posts [0 ]->getRouteKey ()],
338
338
pointsToNextItems: false ,
339
339
),
340
340
'hasMore ' => false ,
341
341
'perPage ' => 3 ,
342
342
'to ' => $ this ->encodeCursor (
343
- ["id " => (string ) $ posts [0 ]->getKey ()],
343
+ ["id " => (string ) $ posts [0 ]->getRouteKey ()],
344
344
pointsToNextItems: true ,
345
345
),
346
346
];
@@ -355,7 +355,7 @@ public function testAfter(): void
355
355
'href ' => 'http://localhost/api/v1/posts? ' . Arr::query ([
356
356
'page ' => [
357
357
'before ' => $ this ->encodeCursor (
358
- ["id " => (string ) $ posts [0 ]->getKey ()],
358
+ ["id " => (string ) $ posts [0 ]->getRouteKey ()],
359
359
pointsToNextItems: false ,
360
360
),
361
361
'limit ' => '3 ' ,
@@ -366,7 +366,7 @@ public function testAfter(): void
366
366
367
367
$ page = $ this ->posts ->repository ()->queryAll ()->paginate ([
368
368
'after ' => $ this ->encodeCursor (
369
- ["id " => (string ) $ posts [1 ]->getKey ()],
369
+ ["id " => (string ) $ posts [1 ]->getRouteKey ()],
370
370
pointsToNextItems: true ,
371
371
),
372
372
'limit ' => '3 ' ,
@@ -390,12 +390,12 @@ public function testAfterWithIdEncoding(): void
390
390
391
391
$ meta = [
392
392
'from ' => $ this ->encodeCursor ([
393
- "id " => 'TEST- ' . $ posts [6 ]->getKey (),
393
+ "id " => 'TEST- ' . $ posts [6 ]->getRouteKey (),
394
394
], pointsToNextItems: false ),
395
395
'hasMore ' => true ,
396
396
'perPage ' => 3 ,
397
397
'to ' => $ this ->encodeCursor ([
398
- "id " => 'TEST- ' . $ posts [4 ]->getKey (),
398
+ "id " => 'TEST- ' . $ posts [4 ]->getRouteKey (),
399
399
], pointsToNextItems: true ),
400
400
];
401
401
@@ -409,7 +409,7 @@ public function testAfterWithIdEncoding(): void
409
409
'href ' => 'http://localhost/api/v1/posts? ' . Arr::query ([
410
410
'page ' => [
411
411
'after ' => $ this ->encodeCursor ([
412
- "id " => "TEST- " . $ posts [4 ]->getKey (),
412
+ "id " => "TEST- " . $ posts [4 ]->getRouteKey (),
413
413
], pointsToNextItems: true ),
414
414
'limit ' => '3 ' ,
415
415
]
@@ -419,7 +419,7 @@ public function testAfterWithIdEncoding(): void
419
419
'href ' => 'http://localhost/api/v1/posts? ' . Arr::query ([
420
420
'page ' => [
421
421
'before ' => $ this ->encodeCursor ([
422
- "id " => "TEST- " . $ posts [6 ]->getKey (),
422
+ "id " => "TEST- " . $ posts [6 ]->getRouteKey (),
423
423
], pointsToNextItems: false ),
424
424
'limit ' => '3 ' ,
425
425
],
@@ -429,7 +429,7 @@ public function testAfterWithIdEncoding(): void
429
429
430
430
$ page = $ this ->posts ->repository ()->queryAll ()->paginate ([
431
431
'after ' => $ this ->encodeCursor ([
432
- "id " => 'TEST- ' . $ posts [7 ]->getKey (),
432
+ "id " => 'TEST- ' . $ posts [7 ]->getRouteKey (),
433
433
], pointsToNextItems: true ),
434
434
'limit ' => 3 ,
435
435
]);
@@ -449,12 +449,12 @@ public function testBefore(): void
449
449
450
450
$ meta = [
451
451
'from ' => $ this ->encodeCursor ([
452
- "id " => (string ) $ posts [3 ]->getKey (),
452
+ "id " => (string ) $ posts [3 ]->getRouteKey (),
453
453
], pointsToNextItems: false ),
454
454
'hasMore ' => true ,
455
455
'perPage ' => 3 ,
456
456
'to ' => $ this ->encodeCursor ([
457
- "id " => (string ) $ posts [1 ]->getKey (),
457
+ "id " => (string ) $ posts [1 ]->getRouteKey (),
458
458
], pointsToNextItems: true ),
459
459
];
460
460
@@ -468,7 +468,7 @@ public function testBefore(): void
468
468
'href ' => 'http://localhost/api/v1/posts? ' . Arr::query ([
469
469
'page ' => [
470
470
'before ' => $ this ->encodeCursor ([
471
- "id " => (string ) $ posts [3 ]->getKey (),
471
+ "id " => (string ) $ posts [3 ]->getRouteKey (),
472
472
], pointsToNextItems: false ),
473
473
'limit ' => '3 ' ,
474
474
]
@@ -478,7 +478,7 @@ public function testBefore(): void
478
478
479
479
$ page = $ this ->posts ->repository ()->queryAll ()->paginate ([
480
480
'before ' => $ this ->encodeCursor ([
481
- "id " => (string ) $ posts [0 ]->getKey (),
481
+ "id " => (string ) $ posts [0 ]->getRouteKey (),
482
482
], pointsToNextItems: false ),
483
483
'limit ' => '3 ' ,
484
484
]);
@@ -501,12 +501,12 @@ public function testBeforeWithIdEncoding(): void
501
501
502
502
$ meta = [
503
503
'from ' => $ this ->encodeCursor ([
504
- "id " => 'TEST- ' . $ posts [6 ]->getKey (),
504
+ "id " => 'TEST- ' . $ posts [6 ]->getRouteKey (),
505
505
], pointsToNextItems: false ),
506
506
'hasMore ' => true ,
507
507
'perPage ' => 3 ,
508
508
'to ' => $ this ->encodeCursor ([
509
- "id " => 'TEST- ' . $ posts [4 ]->getKey (),
509
+ "id " => 'TEST- ' . $ posts [4 ]->getRouteKey (),
510
510
], pointsToNextItems: true ),
511
511
];
512
512
@@ -520,7 +520,7 @@ public function testBeforeWithIdEncoding(): void
520
520
'href ' => 'http://localhost/api/v1/posts? ' . Arr::query ([
521
521
'page ' => [
522
522
'before ' => $ this ->encodeCursor ([
523
- "id " => "TEST- " . $ posts [6 ]->getKey (),
523
+ "id " => "TEST- " . $ posts [6 ]->getRouteKey (),
524
524
], pointsToNextItems: false ),
525
525
'limit ' => '3 ' ,
526
526
],
@@ -530,7 +530,7 @@ public function testBeforeWithIdEncoding(): void
530
530
531
531
$ page = $ this ->posts ->repository ()->queryAll ()->paginate ([
532
532
'before ' => $ this ->encodeCursor ([
533
- "id " => 'TEST- ' . $ posts [3 ]->getKey (),
533
+ "id " => 'TEST- ' . $ posts [3 ]->getRouteKey (),
534
534
], pointsToNextItems: false ),
535
535
'limit ' => 3 ,
536
536
]);
@@ -549,12 +549,12 @@ public function testItUsesModelDefaultPerPage(): void
549
549
550
550
$ meta = [
551
551
'from ' => $ this ->encodeCursor ([
552
- "id " => (string ) $ posts ->last ()->getKey (),
552
+ "id " => (string ) $ posts ->last ()->getRouteKey (),
553
553
], pointsToNextItems: false ),
554
554
'hasMore ' => true ,
555
555
'perPage ' => $ expected ,
556
556
'to ' => $ this ->encodeCursor ([
557
- "id " => (string ) $ posts [1 ]->getKey (),
557
+ "id " => (string ) $ posts [1 ]->getRouteKey (),
558
558
], pointsToNextItems: true ),
559
559
];
560
560
@@ -568,7 +568,7 @@ public function testItUsesModelDefaultPerPage(): void
568
568
'href ' => 'http://localhost/api/v1/posts? ' . Arr::query ([
569
569
'page ' => [
570
570
'after ' => $ this ->encodeCursor ([
571
- "id " => (string ) $ posts [1 ]->getKey (),
571
+ "id " => (string ) $ posts [1 ]->getRouteKey (),
572
572
], pointsToNextItems: true ),
573
573
'limit ' => $ expected ,
574
574
],
@@ -596,12 +596,12 @@ public function testItUsesDefaultPerPage(): void
596
596
597
597
$ meta = [
598
598
'from ' => $ this ->encodeCursor ([
599
- "id " => (string ) $ posts ->last ()->getKey (),
599
+ "id " => (string ) $ posts ->last ()->getRouteKey (),
600
600
], pointsToNextItems: false ),
601
601
'hasMore ' => true ,
602
602
'perPage ' => $ expected ,
603
603
'to ' => $ this ->encodeCursor ([
604
- "id " => (string ) $ posts [1 ]->getKey (),
604
+ "id " => (string ) $ posts [1 ]->getRouteKey (),
605
605
], pointsToNextItems: true ),
606
606
];
607
607
@@ -615,7 +615,7 @@ public function testItUsesDefaultPerPage(): void
615
615
'href ' => 'http://localhost/api/v1/posts? ' . Arr::query ([
616
616
'page ' => [
617
617
'after ' => $ this ->encodeCursor ([
618
- "id " => (string ) $ posts [1 ]->getKey (),
618
+ "id " => (string ) $ posts [1 ]->getRouteKey (),
619
619
], pointsToNextItems: true ),
620
620
'limit ' => $ expected ,
621
621
],
@@ -835,7 +835,7 @@ public function testCustomPageKeys(): void
835
835
'href ' => 'http://localhost/api/v1/posts? ' . Arr::query ([
836
836
'page ' => [
837
837
'next ' => $ this ->encodeCursor (
838
- ["id " => (string ) $ posts [1 ]->getKey ()],
838
+ ["id " => (string ) $ posts [1 ]->getRouteKey ()],
839
839
pointsToNextItems: true ,
840
840
),
841
841
'perPage ' => '3 ' ,
@@ -860,7 +860,7 @@ public function testCustomPageKeys(): void
860
860
'page ' => [
861
861
'perPage ' => '3 ' ,
862
862
'prev ' => $ this ->encodeCursor (
863
- ["id " => (string ) $ posts [0 ]->getKey ()],
863
+ ["id " => (string ) $ posts [0 ]->getRouteKey ()],
864
864
pointsToNextItems: false ,
865
865
),
866
866
],
@@ -870,7 +870,7 @@ public function testCustomPageKeys(): void
870
870
871
871
$ page = $ this ->posts ->repository ()->queryAll ()->paginate ([
872
872
'next ' => $ this ->encodeCursor (
873
- ["id " => (string ) $ posts [1 ]->getKey ()],
873
+ ["id " => (string ) $ posts [1 ]->getRouteKey ()],
874
874
pointsToNextItems: true ,
875
875
),
876
876
'perPage ' => '3 ' ,
@@ -890,12 +890,12 @@ public function testSnakeCaseMetaAndCustomMetaKey(): void
890
890
891
891
$ meta = [
892
892
'from ' => $ this ->encodeCursor ([
893
- "id " => (string ) $ posts [3 ]->getKey (),
893
+ "id " => (string ) $ posts [3 ]->getRouteKey (),
894
894
], pointsToNextItems: false ),
895
895
'has_more ' => true ,
896
896
'per_page ' => 3 ,
897
897
'to ' => $ this ->encodeCursor ([
898
- "id " => (string ) $ posts [1 ]->getKey (),
898
+ "id " => (string ) $ posts [1 ]->getRouteKey (),
899
899
], pointsToNextItems: true ),
900
900
];
901
901
@@ -916,12 +916,12 @@ public function testDashCaseMeta(): void
916
916
917
917
$ meta = [
918
918
'from ' => $ this ->encodeCursor ([
919
- "id " => (string ) $ posts [3 ]->getKey (),
919
+ "id " => (string ) $ posts [3 ]->getRouteKey (),
920
920
], pointsToNextItems: false ),
921
921
'has-more ' => true ,
922
922
'per-page ' => 3 ,
923
923
'to ' => $ this ->encodeCursor ([
924
- "id " => (string ) $ posts [1 ]->getKey (),
924
+ "id " => (string ) $ posts [1 ]->getRouteKey (),
925
925
], pointsToNextItems: true ),
926
926
];
927
927
@@ -942,12 +942,12 @@ public function testMetaNotNested(): void
942
942
943
943
$ meta = [
944
944
'from ' => $ this ->encodeCursor ([
945
- "id " => (string ) $ posts [3 ]->getKey (),
945
+ "id " => (string ) $ posts [3 ]->getRouteKey (),
946
946
], pointsToNextItems: false ),
947
947
'hasMore ' => true ,
948
948
'perPage ' => 3 ,
949
949
'to ' => $ this ->encodeCursor ([
950
- "id " => (string ) $ posts [1 ]->getKey (),
950
+ "id " => (string ) $ posts [1 ]->getRouteKey (),
951
951
], pointsToNextItems: true ),
952
952
];
953
953
@@ -976,7 +976,7 @@ public function testItCanRemoveMeta(): void
976
976
'href ' => 'http://localhost/api/v1/posts? ' . Arr::query ([
977
977
'page ' => [
978
978
'after ' => $ this ->encodeCursor ([
979
- "id " => (string ) $ posts [1 ]->getKey (),
979
+ "id " => (string ) $ posts [1 ]->getRouteKey (),
980
980
], pointsToNextItems: true ),
981
981
'limit ' => '3 ' ,
982
982
],
@@ -1018,7 +1018,7 @@ public function testUrlsIncludeOtherQueryParameters(): void
1018
1018
'include ' => 'author ' ,
1019
1019
'page ' => [
1020
1020
'after ' => $ this ->encodeCursor ([
1021
- "id " => (string ) $ posts [1 ]->getKey (),
1021
+ "id " => (string ) $ posts [1 ]->getRouteKey (),
1022
1022
], pointsToNextItems: true ),
1023
1023
'limit ' => '3 ' ,
1024
1024
],
@@ -1051,12 +1051,12 @@ public function testWithTotal(): void
1051
1051
1052
1052
$ meta = [
1053
1053
'from ' => $ this ->encodeCursor ([
1054
- "id " => (string ) $ posts [3 ]->getKey (),
1054
+ "id " => (string ) $ posts [3 ]->getRouteKey (),
1055
1055
], pointsToNextItems: false ),
1056
1056
'hasMore ' => true ,
1057
1057
'perPage ' => 3 ,
1058
1058
'to ' => $ this ->encodeCursor ([
1059
- "id " => (string ) $ posts [1 ]->getKey (),
1059
+ "id " => (string ) $ posts [1 ]->getRouteKey (),
1060
1060
], pointsToNextItems: true ),
1061
1061
'total ' => 4 ,
1062
1062
];
@@ -1074,7 +1074,7 @@ public function testWithTotal(): void
1074
1074
->queryAll ()
1075
1075
->paginate ([
1076
1076
'after ' => $ this ->encodeCursor ([
1077
- "id " => (string ) $ posts [1 ]->getKey (),
1077
+ "id " => (string ) $ posts [1 ]->getRouteKey (),
1078
1078
], pointsToNextItems: true ),
1079
1079
'limit ' => 3 ,
1080
1080
]);
@@ -1097,12 +1097,12 @@ public function testWithTotalOnFirstPage(): void
1097
1097
1098
1098
$ meta = [
1099
1099
'from ' => $ this ->encodeCursor ([
1100
- "id " => (string ) $ posts [3 ]->getKey (),
1100
+ "id " => (string ) $ posts [3 ]->getRouteKey (),
1101
1101
], pointsToNextItems: false ),
1102
1102
'hasMore ' => true ,
1103
1103
'perPage ' => 3 ,
1104
1104
'to ' => $ this ->encodeCursor ([
1105
- "id " => (string ) $ posts [1 ]->getKey (),
1105
+ "id " => (string ) $ posts [1 ]->getRouteKey (),
1106
1106
], pointsToNextItems: true ),
1107
1107
'total ' => 4 ,
1108
1108
];
@@ -1120,7 +1120,7 @@ public function testWithTotalOnFirstPage(): void
1120
1120
->queryAll ()
1121
1121
->paginate ([
1122
1122
'after ' => $ this ->encodeCursor ([
1123
- "id " => (string ) $ posts [1 ]->getKey (),
1123
+ "id " => (string ) $ posts [1 ]->getRouteKey (),
1124
1124
], pointsToNextItems: true ),
1125
1125
'limit ' => 3 ,
1126
1126
]);
0 commit comments