nitpicks
This commit is contained in:
parent
3d89be273c
commit
70de43e050
|
|
@ -7,7 +7,7 @@ use Illuminate\Http\Request;
|
|||
|
||||
class EventController extends EchoController
|
||||
{
|
||||
/** @var ChannelManager */
|
||||
/** @var \BeyondCode\LaravelWebSockets\LaravelEcho\Pusher\Channels\ChannelManager */
|
||||
protected $channelManager;
|
||||
|
||||
public function __construct(ChannelManager $channelManager)
|
||||
|
|
@ -31,12 +31,13 @@ class EventController extends EchoController
|
|||
foreach ($request->json()->get('channels', []) as $channelId) {
|
||||
$channel = $this->channelManager->find($request->appId, $channelId);
|
||||
|
||||
$channel->broadcast([
|
||||
optional($channel)->broadcast([
|
||||
'channel' => $channelId,
|
||||
'event' => $request->json()->get('name'),
|
||||
'data' => $request->json()->get('data'),
|
||||
]);
|
||||
}
|
||||
|
||||
return $request->json()->all();
|
||||
}
|
||||
}
|
||||
|
|
@ -25,7 +25,7 @@ class ChannelManager
|
|||
return $this->channels[$appId][$channelId];
|
||||
}
|
||||
|
||||
public function find(string $appId, string $channelId)
|
||||
public function find(string $appId, string $channelId): ?Channel
|
||||
{
|
||||
return $this->channels[$appId][$channelId] ?? null;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue