v0.1.10
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace kernel\modules\notification\contracts;
|
||||
|
||||
abstract class NotificationMessage
|
||||
{
|
||||
protected array $channels = [];
|
||||
|
||||
abstract public function getMessage(): string;
|
||||
abstract public function getSubject(): string;
|
||||
|
||||
public function via(): array
|
||||
{
|
||||
return $this->channels;
|
||||
}
|
||||
|
||||
public function addChannel(string $channel): void
|
||||
{
|
||||
if (!in_array($channel, $this->channels)) {
|
||||
$this->channels[] = $channel;
|
||||
}
|
||||
}
|
||||
|
||||
public function toArray(): array
|
||||
{
|
||||
return [
|
||||
'message' => $this->getMessage(),
|
||||
'subject' => $this->getSubject(),
|
||||
];
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user