> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fetchski-attract.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Paging

> One call for a whole list, however it pages.

Lists answer a page at a time, and not all of them page the same way. Every list method has an
`…All()` twin that walks it for you: a `LazyCollection` that fetches a page as you iterate and stops
after the last.

```php theme={"dark"}
Attract::faqItems()->listFaqItemsAll(perPage: 50)
    ->each(fn ($item) => logger()->info($item->title));
```

It takes the list's own arguments, minus the page or cursor. Every Collection method works on it:
`filter()`, `take(10)`, `chunk(100)`, `first()`.

> [!TIP]
>
> In Tinker, an `…All()` list prints its items, fetching every page to show them. On a big list, add
> `->take(20)`. More ways to read a result: [Working with results](https://docs.fetchski-attract.com/laravel/working-with-results.md).

## Only some fields

When you need only a few fields of every document, its id above all, each list method that takes
`fields` also has a `…Pick()` twin. It walks every page too, 100 documents a page, and each item is a
plain array of the document's `id` and the fields you named:

```php theme={"dark"}
$about = Attract::pages()->listPagesPick(fields: ['title', 'slug'])->firstWhere('slug', '/about-us');
// ['id' => 'ckq3v8x5b0002:en:published', 'title' => 'About Us', 'slug' => '/about-us']
```

The rows aren't Data classes: each value is as the site sends it. More in [Find an id](https://docs.fetchski-attract.com/find-an-id.md).

## How each list pages

> [tab] By page
>
> Content lists and members (until `pages`), the media lists (from `total` and `perPage`; their page
> size is `limit`), form submissions, the request log, the access and conversion viewers.

> [tab] By cursor
>
> Conversion events: `since`, with the next cursor while there is more.

> [tab] Backwards
>
> Document versions: `before`, until there is no next one (management SDK).

> [!TIP]
>
> It can never loop: an answer for another page than the one asked for, or the same cursor twice, throws.
> An answer that names its page but no page count throws too, rather than stopping quietly.

## One page

The list method itself answers one page, with where you are:

```php theme={"dark"}
$page = Attract::blogPosts()->listBlogs(page: 2, perPage: 20);

$page->results;      // Collection<Blog>
$page->currentPage;  // 2
$page->pages;        // how many pages the list has
```

## Watching every call

Every call runs on Laravel's HTTP client, so Telescope and Pulse see it, and `log_channel` (in
`config/fetchski-attract.php`) writes one line per call: site, method, path, status and time.

> [card] [Next: testing](https://docs.fetchski-attract.com/laravel/testing.md)
>
> Three-line tests, and an Action for any method.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.