Skip to content

[12.x] Add newRequest() to Pool and Batch#58038

Merged
taylorotwell merged 1 commit into
laravel:12.xfrom
cosmastech:pool-and-batch-as
Dec 6, 2025
Merged

[12.x] Add newRequest() to Pool and Batch#58038
taylorotwell merged 1 commit into
laravel:12.xfrom
cosmastech:pool-and-batch-as

Conversation

@cosmastech

Copy link
Copy Markdown
Contributor

This adds convenience for folks who want to create a new request without having to name it.

function addPromiseMapping($promise) {
    $promise->get('https://laravel.com/careers')
        ->then(fn ($response) => str_contains($response->body(), 'software engineer'));
}

Http::pool(function (Pool $pool) {
    addPromiseMapping($pool->newRequest());
    addPromiseMapping($pool->newRequest());
});

Prior to this, you would have to name the request (via Pool@as()) even if that wasn't convenient for the use case.

@taylorotwell taylorotwell merged commit 40506d8 into laravel:12.x Dec 6, 2025
76 checks passed
akyrey pushed a commit to akyrey/framework that referenced this pull request Dec 29, 2025
@cosmastech cosmastech deleted the pool-and-batch-as branch January 24, 2026 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants