user()->id ?? null; } if (is_null($userId)) { throw new \Exception("User id is null"); } $this->userId = $userId; } public function broadcastOn(): array { return [ new PrivateChannel("custom.{$this->userId}"), ]; } }