Skip to content

Commit 2fe2a45

Browse files
committed
fix
1 parent a96deac commit 2fe2a45

File tree

1 file changed

+15
-18
lines changed

1 file changed

+15
-18
lines changed

src/Integration/Requests/Document/UploadSignatureDocument.php

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Elegantly\Yousign\Integration\Requests\Document;
44

5+
use Illuminate\Support\Collection;
56
use Psr\Http\Message\StreamInterface;
67
use Saloon\Contracts\Body\HasBody;
78
use Saloon\Data\MultipartValue;
@@ -39,7 +40,7 @@ public function __construct(
3940

4041
protected function defaultBody(): array
4142
{
42-
return [
43+
return collect([
4344
new MultipartValue(
4445
name: 'file',
4546
value: $this->file,
@@ -48,22 +49,18 @@ protected function defaultBody(): array
4849
name: 'nature',
4950
value: $this->nature,
5051
),
51-
new MultipartValue(
52-
name: 'insert_after_id',
53-
value: $this->insert_after_id,
54-
),
55-
new MultipartValue(
56-
name: 'password',
57-
value: $this->password,
58-
),
59-
new MultipartValue(
60-
name: 'initials',
61-
value: $this->initials,
62-
),
63-
new MultipartValue(
64-
name: 'parse_anchors',
65-
value: $this->parse_anchors ? 'true' : 'false',
66-
),
67-
];
52+
])->when($this->insert_after_id, fn (Collection $params) => $params->push(new MultipartValue(
53+
name: 'insert_after_id',
54+
value: $this->insert_after_id,
55+
)))->when($this->password, fn (Collection $params) => $params->push(new MultipartValue(
56+
name: 'password',
57+
value: $this->password,
58+
)))->when($this->initials, fn (Collection $params) => $params->push(new MultipartValue(
59+
name: 'initials',
60+
value: $this->initials,
61+
)))->when($this->parse_anchors, fn (Collection $params) => $params->push(new MultipartValue(
62+
name: 'parse_anchors',
63+
value: $this->parse_anchors ? 'true' : 'false',
64+
)))->toArray();
6865
}
6966
}

0 commit comments

Comments
 (0)