@@ -20,27 +20,27 @@ final class InfiniteScroll
2020 *
2121 * @phpstan-ignore-next-line missingType.generics
2222 */
23- public function make (string $ key , Builder |CursorPaginator |Paginator $ paginator , int $ perPage = 15 , array $ columns = ['* ' ]): array
23+ public function make (string $ key , Builder |CursorPaginator |Paginator $ data , int $ perPage = 15 , array $ columns = ['* ' ]): array
2424 {
25- if ($ paginator instanceof Paginator) {
25+ if ($ data instanceof Paginator) {
2626 return [
27- $ key => Inertia::defer (fn () => $ paginator -> items () )->deepMerge (),
27+ $ key => Inertia::defer (fn () => $ data )->deepMerge (),
2828 'type ' => fn (): PaginationType => PaginationType::PAGED ,
29- 'page ' => fn () => $ paginator ->currentPage (),
30- 'hasMore ' => fn () => $ paginator ->hasMorePages (),
29+ 'page ' => fn () => $ data ->currentPage (),
30+ 'hasMore ' => fn () => $ data ->hasMorePages (),
3131 'perPage ' => fn (): int => $ perPage ,
3232 ];
3333 }
3434
35- if ($ paginator instanceof Builder) {
36- $ paginator = $ paginator ->cursorPaginate (perPage: $ perPage , columns: $ columns );
35+ if ($ data instanceof Builder) {
36+ $ data = $ data ->cursorPaginate (perPage: $ perPage , columns: $ columns );
3737 }
3838
3939 return [
40- $ key => Inertia::defer (fn () => $ paginator -> items () )->deepMerge (),
40+ $ key => Inertia::defer (fn () => $ data )->deepMerge (),
4141 'type ' => fn (): PaginationType => PaginationType::CURSOR ,
42- 'cursor ' => fn () => $ paginator ->nextCursor ()?->encode(),
43- 'hasMore ' => fn () => $ paginator ->hasMorePages (), // @phpstan-ignore-line method.notFound
42+ 'cursor ' => fn () => $ data ->nextCursor ()?->encode(),
43+ 'hasMore ' => fn () => $ data ->hasMorePages (), // @phpstan-ignore-line method.notFound
4444 'perPage ' => fn (): int => $ perPage ,
4545 ];
4646 }
0 commit comments