Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.x] Add attachMany method to the PendingRequest.php #34697

Merged
merged 2 commits into from
Oct 6, 2020

Conversation

AliN11
Copy link
Contributor

@AliN11 AliN11 commented Oct 6, 2020

With this method, we can attach multiple files once, instead of using attach for each file.

Usage:

$response = Http::attachMany(
    ['image1', file_get_contents('cat1.jpg'), 'photo1.jpg'],
    ['image2', file_get_contents('cat2.jpg'), 'photo2.jpg'],
    ['image3', file_get_contents('cat3.jpg'), 'photo3.jpg'],
)->post('http://test.com/posts');

With this method, we can attach multiple files instead of using `attach` for each file.
@driesvints driesvints changed the title Add attachMany method to the PendingRequest.php [8.x] Add attachMany method to the PendingRequest.php Oct 6, 2020
@taylorotwell
Copy link
Member

Tweaked this to just allow attach to accept an array.

@taylorotwell taylorotwell merged commit 2f0955d into laravel:8.x Oct 6, 2020
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