Commit 45b7ccf
Allow for string events
String events are especially useful for passing custom data to the listener. Consider the following:
```php
use Native\Laravel\Client\Client;
use Native\Laravel\Notification;
// Send a notification with a custom event
$client = new Client();
$notification = new Notification($client);
$articleId = 1;
$notification->title('EXTRA EXTRA READ ALL ABOUT IT')
->message('You should totally click this)
->event('notification.clicked.newArticle' . $articleId)
->show();
// Listen to the notification
Event::listen('notification.clicked.newArticle.*', function ($event) {
$event = explode('.', $event)
$articleId = array_last($event);
// do stuff...
});
```1 parent e9a7532 commit 45b7ccf
1 file changed
+5
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | | - | |
| 12 | + | |
14 | 13 | | |
| 14 | + | |
| 15 | + | |
15 | 16 | | |
| 17 | + | |
| 18 | + | |
16 | 19 | | |
17 | 20 | | |
18 | 21 | | |
| |||
0 commit comments