notification = $notification; $this->userId = $userId; } /** * Get the channels the event should broadcast on. * * @return \Illuminate\Broadcasting\Channel|array */ public function broadcastOn() { return new PrivateChannel('notifications.' . $this->userId); } /** * The event's broadcast name. * * @return string */ public function broadcastAs() { return 'notification.received'; } }