You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The service provider will be auto-detected by Laravel. So, no need to register it manually.
33
+
32
34
Next, make sure you have a valid sendgrid api key at `config/services.php`. You may copy the example configuration below to get started:
33
35
34
36
```php
@@ -39,26 +41,43 @@ Next, make sure you have a valid sendgrid api key at `config/services.php`. You
39
41
40
42
## Usage
41
43
42
-
You should add a `toSendGrid` method into the notification class. This method will receive a `$notifiable` entity and should return a `NotificationChannels\SendGrid\SendGridMessage` instance:
44
+
To make use of this package, your notification classshould look like this:
43
45
44
46
```php
45
-
/**
46
-
* Get the SendGrid representation of the notification.
return (new SendGridMessage('Your SendGrid template ID'))
54
-
->payload([
55
-
"template_var_1" => "template_value_1"
56
-
])
57
-
->from('test@example.com', 'Example User')
58
-
->to('test+test1@example.com', 'Example User1');
68
+
->payload([
69
+
"template_var_1" => "template_value_1"
70
+
]);
59
71
}
72
+
}
73
+
60
74
```
61
75
76
+
`toSendGrid` method will receive a `$notifiable` entity and should return a `NotificationChannels\SendGrid\SendGridMessage` instance.
77
+
78
+
💡 Unless you set them explicitly, **From** address will be `config('mail.from.address')` and the **To** value will be what returns from `$notifiable->routeNotificationFor('mail');`
79
+
80
+
62
81
## Changelog
63
82
64
83
Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.
0 commit comments