the browser-facing portion of osu!
at master 1.0 kB view raw
1<?php 2 3// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public License v3.0. 4// See the LICENCE file in the repository root for full licence text. 5 6namespace App\Events; 7 8use Illuminate\Broadcasting\Channel; 9use Illuminate\Queue\SerializesModels; 10 11class NotificationReadEvent extends NotificationEventBase 12{ 13 use SerializesModels; 14 15 public $params; 16 public $userId; 17 18 /** 19 * Create a new event instance. 20 * 21 * @return void 22 */ 23 public function __construct($userId, array $params) 24 { 25 parent::__construct(); 26 27 $this->params = $params; 28 $this->userId = $userId; 29 } 30 31 public function broadcastAs() 32 { 33 return 'read'; 34 } 35 36 /** 37 * Get the channels the event should broadcast on. 38 * 39 * @return Channel|array 40 */ 41 public function broadcastOn() 42 { 43 return new Channel("notification_read:{$this->userId}"); 44 } 45 46 public function broadcastWith() 47 { 48 return $this->params; 49 } 50}