Skip to content

Commit

Permalink
add $notification as param to routeNotificationFor (#20)
Browse files Browse the repository at this point in the history
* feat: add $notification as param to $notifiable->routeNotificationFor

* test: add $notification to test case
  • Loading branch information
phgrund committed Mar 1, 2024
1 parent 48cee97 commit 2e38986
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/SendGridChannel.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function send($notifiable, Notification $notification)
}

if (empty($message->tos)) {
$to = $notifiable->routeNotificationFor('mail');
$to = $notifiable->routeNotificationFor('mail', $notification);

// Handle the case where routeNotificationForMail returns an array (email => name)
if (is_array($to)) {
Expand Down
4 changes: 2 additions & 2 deletions tests/SendGridChannelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public function toSendGrid($notifiable)
$notifiable = new class {
use Notifiable;

public function routeNotificationForMail()
public function routeNotificationForMail($notification)
{
return '[email protected]';
}
Expand All @@ -124,7 +124,7 @@ public function routeNotificationForMail()
$notifiableWithEmailAndName = new class {
use Notifiable;

public function routeNotificationForMail()
public function routeNotificationForMail($notification)
{
return [
'[email protected]' => 'John Doe',
Expand Down

0 comments on commit 2e38986

Please sign in to comment.