Skip to content

Commit 10837d5

Browse files
committed
Support for actions and reply
1 parent 3399942 commit 10837d5

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

src/Notification.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ class Notification
1414

1515
protected string $event = '';
1616

17+
private bool $hasReply = false;
18+
19+
private string $replyPlaceholder = '';
20+
21+
private array $actions = [];
22+
1723
final public function __construct(protected Client $client)
1824
{
1925
$this->title = config('app.name');
@@ -45,6 +51,21 @@ public function event(string $event): self
4551
return $this;
4652
}
4753

54+
public function hasReply(string $placeholder = ''): self
55+
{
56+
$this->hasReply = true;
57+
$this->replyPlaceholder = $placeholder;
58+
59+
return $this;
60+
}
61+
62+
public function addAction(string $label): self
63+
{
64+
$this->actions[] = $label;
65+
66+
return $this;
67+
}
68+
4869
public function message(string $body): self
4970
{
5071
$this->body = $body;
@@ -59,6 +80,9 @@ public function show(): self
5980
'title' => $this->title,
6081
'body' => $this->body,
6182
'event' => $this->event,
83+
'hasReply' => $this->hasReply,
84+
'replyPlaceholder' => $this->replyPlaceholder,
85+
'actions' => $this->actions,
6286
]);
6387

6488
$this->reference = $response->json('reference');

0 commit comments

Comments
 (0)