-
-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for multiple events #26
base: main
Are you sure you want to change the base?
Conversation
Good PR! The only thing I am missing is that in my case the data is also different per event. Maybe you could pass the event name in the {
"time_ms": 1697717045179,
"events": [
{
"name": "channel_occupied",
"channel": "admin",
"data": {} <---
},
{
"name": "member_added",
"channel": "admin",
"data": {} <---
}
]
} public function getData(Request $request, string $event): array
{
return $request->collect('events')
->filter(fn($item) => $item['name'] === $event)
->map(fn($item) => $item['data'])
->toArray();
} |
@jeffreyvanhees Did you grab the latest version? Maybe run |
@jeffreyvanhees Here's the README change in the PR to show you how: |
As far as I know I have the latest version. ( I get the error receiver/src/AbstractWebhook.php Line 79 in 2a6893c
Also, can you give an example how to use the Note: in the new example you'd add to the readme, you use $this->request instead of the $request-argument. Is there a reason for that? |
This PR adds support for handling multiple events in a single payload.
The
getEvent
method has been updated to support the return of either astring
orarray
value, and thehandle
method updated accordingly.Resolves #13