Skip to content

Commit 31680b3

Browse files
add support template for
1 parent a966ed0 commit 31680b3

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

src/Notifications/Messages/MessagePayload.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@
44

55
class MessagePayload
66
{
7-
public function __construct(private string $to, private string $content, private string $from = '')
7+
public function __construct(
8+
private string $to,
9+
private string $content,
10+
private string $from = '',
11+
private mixed $template = null
12+
)
813
{
914
}
1015

@@ -22,4 +27,9 @@ public function from(): string
2227
{
2328
return $this->from;
2429
}
30+
31+
public function template(): mixed
32+
{
33+
return $this->template;
34+
}
2535
}

src/Notifications/Messages/OTPMessage.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ class OTPMessage
1010

1111
private string $from = '';
1212

13+
private mixed $template = null;
14+
1315
public function content(string $content): static
1416
{
1517
$this->content = $content;
@@ -31,8 +33,15 @@ public function from(string $from): static
3133
return $this;
3234
}
3335

36+
public function template(mixed $template): static
37+
{
38+
$this->template = $template;
39+
40+
return $this;
41+
}
42+
3443
public function getPayload(): MessagePayload
3544
{
36-
return (new MessagePayload($this->to, $this->content, $this->from));
45+
return (new MessagePayload($this->to, $this->content, $this->from, $this->template));
3746
}
3847
}

0 commit comments

Comments
 (0)