Skip to content

Commit

Permalink
Add attachMany method to the PendingRequest.php
Browse files Browse the repository at this point in the history
With this method, we can attach multiple files instead of using `attach` for each file.
  • Loading branch information
AliN11 authored Oct 6, 2020
1 parent af99030 commit bd02d3d
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/Illuminate/Http/Client/PendingRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,21 @@ public function attach($name, $contents, $filename = null, array $headers = [])

return $this;
}

/**
* Attach multiple files to the request. Accepts an array containing arrays of files
*
* @param array $files
* @return $this
*/
public function attachMany(array $files)
{
foreach ($files as $file) {
$this->attach(...$file);
}

return $this;
}

/**
* Indicate the request is a multi-part form request.
Expand Down

0 comments on commit bd02d3d

Please sign in to comment.