Skip to content

Commit 0f4996d

Browse files
committed
Added support for AnonymousNotifiable
1 parent d5079b1 commit 0f4996d

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/CamooChannel.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Undjike\CamooNotificationChannel;
44

5+
use Illuminate\Notifications\AnonymousNotifiable;
56
use Illuminate\Notifications\Notification;
67
use Undjike\CamooNotificationChannel\Exceptions\CouldNotSendNotification;
78
use Undjike\CamooNotificationChannel\Requests\SendMessageRequest;
@@ -19,9 +20,11 @@ class CamooChannel
1920
*/
2021
public function send($notifiable, Notification $notification): mixed
2122
{
22-
$recipient = is_string($notifiable)
23-
? $notifiable
24-
: $notifiable->routeNotificationFor('Camoo');
23+
$recipient = match (true) {
24+
is_string($notifiable) => $notifiable,
25+
$notifiable instanceof AnonymousNotifiable => $notifiable->routeNotificationFor(__CLASS__),
26+
default => $notifiable->routeNotificationFor('Camoo')
27+
};
2528

2629
if (! $recipient) {
2730
throw CouldNotSendNotification::camooRespondedWithAnError(

0 commit comments

Comments
 (0)