This commit is contained in:
2025-08-01 14:29:50 +03:00
parent 2ab819ff30
commit b86b8ff923
54 changed files with 1512 additions and 672 deletions

View File

@@ -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(),
];
}
}