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
Copy file name to clipboardExpand all lines: README.md
+39-1Lines changed: 39 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -72,7 +72,7 @@ __These keys must be safely stored and should not change.__
72
72
73
73
## Usage
74
74
75
-
Now you can use the channel in your `via()` method inside the notification and send a web push notification:
75
+
Now you can use the channel in your `via()` method inside the notification and send a generic web push notification:
76
76
77
77
```php
78
78
use Illuminate\Notifications\Notification;
@@ -107,6 +107,44 @@ class AccountApproved extends Notification
107
107
}
108
108
```
109
109
110
+
This package also supports [Declarative Web Push messages](https://www.w3.org/TR/push-api/#declarative-push-message), which aim to reduce the complexity of using push on the web in general and address some challenges of generic web push notifications like privacy concerns & battery life on mobile by making a client-side service worker optional while remaining fully backwards compatible.
111
+
112
+
```php
113
+
use Illuminate\Notifications\Notification;
114
+
use NotificationChannels\WebPush\DeclarativeWebPushMessage;
115
+
use NotificationChannels\WebPush\WebPushChannel;
116
+
117
+
class AccountApproved extends Notification
118
+
{
119
+
public function via($notifiable)
120
+
{
121
+
return [WebPushChannel::class];
122
+
}
123
+
124
+
public function toWebPush($notifiable, $notification)
0 commit comments