title: Laravel, get User id for BroadcastOn()
body: <p>I'd need to get user's id for the channel name via BroadcastOn() function?</p>
  
  <p>What I'm trying to do is:</p>
  
  <p>New event:</p>
  
  <pre><code>event(new \App\Events\chat($message, $userid, $avatar, $username, $receiver, $msgid));
  </code></pre>
  
  <p>Event itself </p>
  
  <pre><code>public $message;
      public $user;
      public $avatar;
      public $username;
      public $receiver;
  </code></pre>
  
  <p>Construct: </p>
  
  <pre><code>public function __construct($message, $user, $avatar,$username,$receiver,$msgid) {
          $this-&gt;message = $message;
          $this-&gt;user = $user;
          $this-&gt;avatar = $avatar;
          $this-&gt;username = $username;
          $this-&gt;receiver = $receiver;
          $this-&gt;msgid = $msgid;
  
      }
  </code></pre>
  
  <p>Broadcast:</p>
  
  <pre><code>public function broadcastOn() {
          $user = \Auth::user()-&gt;id();
          return new Channel($user);
      }
  </code></pre>
  
  <p>And if I try to dd \Auth::user(); it gives me null, which I suppose is that user is not recognized in the events via auth. Is there a way to pass user to broadcastOn() somehow so I could define it as a channel name?  </p>