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