isPublic = $isPublic; } /** * @return array */ public function broadcastOn(): array { $isPublic = $this->isPublic ?? WebhookEndpoint::query() ->whereKey($this->endpointId) ->value('is_public'); return [ $isPublic ? new Channel('webhooks.'.$this->endpointId) : new PrivateChannel('webhooks.'.$this->endpointId), ]; } public function broadcastAs(): string { return 'webhook.request.received'; } /** * @return array{endpointId: string, requestId: string} */ public function broadcastWith(): array { return [ 'endpointId' => $this->endpointId, 'requestId' => $this->requestId, ]; } }