File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ class CreateAPostInAGivenStream extends Request implements HasBody
2020
2121 public function __construct (
2222 protected readonly string $ streamId ,
23- protected readonly string $ text ,
23+ protected readonly ? string $ text = null ,
2424 protected readonly ?string $ title = null ,
2525 protected null |array |Collection $ labels = null ,
2626 protected readonly bool $ sticky = false ,
@@ -53,14 +53,16 @@ protected function defaultQuery(): array
5353
5454 public function defaultBody (): array
5555 {
56- $ body = [
57- 'text ' => $ this ->text ,
58- ];
56+ $ body = [];
5957
60- if (! empty ($ this ->title )) {
58+ if (filled ($ this ->title )) {
6159 $ body = Arr::add (array: $ body , key: 'title ' , value: $ this ->title );
6260 }
6361
62+ if (filled ($ this ->text )) {
63+ $ body = Arr::add (array: $ body , key: 'text ' , value: $ this ->text );
64+ }
65+
6466 $ labels = $ this ->labels ;
6567
6668 if ($ labels instanceof Collection) {
You can’t perform that action at this time.
0 commit comments