This commit is contained in:
Adrian Hopek
2022-04-26 12:46:18 +02:00
parent cbfc2b0c45
commit 7f5e462e4d
54 changed files with 361 additions and 211 deletions

View File

@@ -0,0 +1,11 @@
<?php
declare(strict_types=1);
namespace Toby\Domain\Notifications;
class Channels
{
public const MAIL = "mail";
public const SLACK = "slack";
}

View File

@@ -19,10 +19,10 @@ class KeyHasBeenGivenNotification extends Notification
public function via(): array
{
return ["slack"];
return [Channels::SLACK];
}
public function toSlack($notifiable): string
public function toSlack(Notifiable $notifiable): string
{
return __(":sender gives key no :key to :recipient", [
"sender" => $this->getName($this->sender),

View File

@@ -19,10 +19,10 @@ class KeyHasBeenTakenNotification extends Notification
public function via(): array
{
return ["slack"];
return [Channels::SLACK];
}
public function toSlack($notifiable): string
public function toSlack(Notifiable $notifiable): string
{
return __(":recipient takes key no :key from :sender", [
"recipient" => $this->getName($this->recipient),

View File

@@ -0,0 +1,10 @@
<?php
declare(strict_types=1);
namespace Toby\Domain\Notifications;
interface Notifiable
{
public function notify($instance);
}

View File

@@ -20,7 +20,7 @@ class VacationRequestCreatedNotification extends Notification
public function via(): array
{
return ["mail", "slack"];
return [Channels::MAIL, Channels::SLACK];
}
public function toSlack(): string

View File

@@ -22,7 +22,7 @@ class VacationRequestStatusChangedNotification extends Notification
public function via(): array
{
return ["mail", "slack"];
return [Channels::MAIL, Channels::SLACK];
}
public function toSlack(): string

View File

@@ -23,7 +23,7 @@ class VacationRequestWaitsForApprovalNotification extends Notification
public function via(): array
{
return ["mail", "slack"];
return [Channels::MAIL, Channels::SLACK];
}
public function toSlack(): string