Skip to content
This repository has been archived by the owner on Feb 7, 2024. It is now read-only.

Commit

Permalink
Make TriggerEventController accept both 'channel' and 'channels'. (#1046
Browse files Browse the repository at this point in the history
)
  • Loading branch information
madpilot78 authored Oct 19, 2022
1 parent f0649b6 commit 50f8a1e
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/HttpApi/Controllers/TriggerEventController.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,19 @@ class TriggerEventController extends Controller
public function __invoke(Request $request)
{
$this->ensureValidSignature($request);
$payload = $request->json();

foreach ($request->json()->get('channels', []) as $channelName) {
if ($payload->has('channel')) {
$channels = [$payload->get('channel')];
} else {
$channels = $payload->get('channels', []);

if (is_string($channels)) {
$channels = [$channels];
}
}

foreach ($channels as $channelName) {
$channel = $this->channelManager->find($request->appId, $channelName);

optional($channel)->broadcastToEveryoneExcept([
Expand Down

0 comments on commit 50f8a1e

Please sign in to comment.