refactor(notifications): standardize getRecipients method signatures
This commit is contained in:
@@ -13,7 +13,7 @@ class EmailChannel
|
||||
{
|
||||
try {
|
||||
$this->bootConfigs($notifiable);
|
||||
$recipients = $notifiable->getRecipients($notification);
|
||||
$recipients = $notifiable->getRecipients();
|
||||
if (count($recipients) === 0) {
|
||||
throw new Exception('No email recipients found');
|
||||
}
|
||||
|
||||
@@ -4,5 +4,5 @@ namespace App\Notifications\Channels;
|
||||
|
||||
interface SendsEmail
|
||||
{
|
||||
public function getRecipients($notification);
|
||||
public function getRecipients(): array;
|
||||
}
|
||||
|
||||
22
app/Notifications/Notification.php
Normal file
22
app/Notifications/Notification.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Notifications;
|
||||
|
||||
use App\Notifications\Channels\SendsEmail;
|
||||
use App\Notifications\Dto\DiscordMessage;
|
||||
use App\Notifications\Dto\PushoverMessage;
|
||||
use App\Notifications\Dto\SlackMessage;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
|
||||
interface Notification
|
||||
{
|
||||
public function toMail(SendsEmail $notifiable): MailMessage;
|
||||
|
||||
public function toPushover(): PushoverMessage;
|
||||
|
||||
public function toDiscord(): DiscordMessage;
|
||||
|
||||
public function toSlack(): SlackMessage;
|
||||
|
||||
public function toTelegram();
|
||||
}
|
||||
Reference in New Issue
Block a user