Skip to content

Commit d5079b1

Browse files
committed
Support string notifiable
1 parent bff296d commit d5079b1

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

src/CamooChannel.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,13 @@ class CamooChannel
1717
* @return mixed
1818
* @throws CouldNotSendNotification
1919
*/
20-
public function send($notifiable, Notification $notification)
20+
public function send($notifiable, Notification $notification): mixed
2121
{
22-
if (! $recipient = $notifiable->routeNotificationFor('Camoo')) {
22+
$recipient = is_string($notifiable)
23+
? $notifiable
24+
: $notifiable->routeNotificationFor('Camoo');
25+
26+
if (! $recipient) {
2327
throw CouldNotSendNotification::camooRespondedWithAnError(
2428
'Your notifiable instance does not have function routeNotificationForCamoo.'
2529
);

src/CamooServiceProvider.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,9 @@ class CamooServiceProvider extends ServiceProvider
1111
/**
1212
* Register the application services.
1313
*
14-
* @noinspection ReturnTypeCanBeDeclaredInspection
1514
* @noinspection PhpUnusedParameterInspection
1615
*/
17-
public function register()
16+
public function register(): void
1817
{
1918
Notification::resolved(function (ChannelManager $service) {
2019
$service->extend('camoo', function ($app) {

src/Requests/SendMessageRequest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ class SendMessageRequest
1616
* @return mixed
1717
* @throws CouldNotSendNotification
1818
* @noinspection PhpUndefinedFunctionInspection
19+
* @noinspection PhpPossiblePolymorphicInvocationInspection
1920
*/
20-
public static function execute(CamooMessage $message, $addressee, array $auth = null)
21+
public static function execute(CamooMessage $message, array|string $addressee, array $auth = null): mixed
2122
{
2223
$auth ??= [
2324
'key' => config('services.camoo.key'),

0 commit comments

Comments
 (0)