Skip to content

Pagination

Standard Pagination

Returns a Laravel LengthAwarePaginator compatible with Blade views and API resources:

php
use Rollogi\LaravelHubspot\Crm\Contact;

$contacts = Contact::query()
    ->where('email', 'like', 'example.com')
    ->paginate(perPage: 25);

Cursor-Based Iteration

For memory-efficient iteration over large datasets, use cursor() which returns a LazyCollection:

php
use Rollogi\LaravelHubspot\Crm\Contact;

Contact::query()
    ->where('email', 'like', 'example.com')
    ->cursor()
    ->each(function (Contact $contact): void {
        // Process each contact without loading all into memory
    });

Limit and Offset

php
use Rollogi\LaravelHubspot\Crm\Contact;

$contacts = Contact::query()
    ->take(10)      // Limit results per page
    ->skip(20)      // Pagination cursor offset
    ->get();