userId = $userId; $this->guard = $guard; } /** * Get the channels the event should broadcast on. * * @return array */ public function broadcastOn(): array { return [ new PrivateChannel('user.logout.' . $this->userId), ]; } /** * The event's broadcast name. * * @return string */ public function broadcastAs() { return 'forced-logout'; } /** * Get the data to broadcast. * * @return array */ public function broadcastWith() { return [ 'user_id' => $this->userId, 'guard' => $this->guard, // Send translation key instead of translated message so it translates in user's locale 'message_key' => 'For security and maintenance, a system administrator has logged you out of your account. Sorry for this inconvenience and thanks for your patience.', ]; } }