commentable = $comment->commentable; } /** @return array */ public function broadcastOn(): array { $prefix = Config::getBroadcastChannelPrefix(); return [ new PrivateChannel("{$prefix}.{$this->comment->commentable_type}.{$this->comment->commentable_id}"), ]; } public function broadcastWhen(): bool { return Config::isBroadcastingEnabled(); } /** @return array{comment_id: int|string, commentable_type: string, commentable_id: int|string} */ public function broadcastWith(): array { return [ 'comment_id' => $this->comment->id, 'commentable_type' => $this->comment->commentable_type, 'commentable_id' => $this->comment->commentable_id, ]; } }