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 App\Libraries\MorphMap;
9use App\Models\Notification;
10use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
11
12abstract class NotificationEventBase extends BroadcastableEventBase implements ShouldBroadcast
13{
14 public $broadcastQueue;
15
16 public static function generateChannelName($notifiable, $subtype)
17 {
18 return 'new:'.
19 MorphMap::getType($notifiable).
20 ':'.
21 $notifiable->getKey().
22 (in_array($subtype, Notification::SUBTYPES, true) ? ":{$subtype}" : '');
23 }
24
25 public function __construct()
26 {
27 $this->broadcastQueue = $GLOBALS['cfg']['osu']['notification']['queue_name'];
28 }
29}