1 | <?php |
||
20 | class NotificationManager |
||
21 | { |
||
22 | /** |
||
23 | * @var ChannelManager |
||
24 | */ |
||
25 | protected $channelManager; |
||
26 | /** |
||
27 | * @var DatabaseNotificationManager |
||
28 | */ |
||
29 | protected $databaseNotificationManager; |
||
30 | /** |
||
31 | * @var |
||
32 | */ |
||
33 | protected $propertyAccessor; |
||
34 | /** |
||
35 | * @var array |
||
36 | */ |
||
37 | protected $broadcasters = []; |
||
38 | |||
39 | /** |
||
40 | * NotificationManager constructor. |
||
41 | * |
||
42 | * @param ChannelManager $channelManager |
||
43 | * @param DatabaseNotificationManager|null $databaseNotificationManager |
||
44 | */ |
||
45 | public function __construct(ChannelManager $channelManager, DatabaseNotificationManager $databaseNotificationManager = null) |
||
50 | |||
51 | /** |
||
52 | * @param $key |
||
53 | * @param Broadcaster $broadcaster |
||
54 | */ |
||
55 | public function setBroadcaster($key, Broadcaster $broadcaster) |
||
59 | |||
60 | /** |
||
61 | * @param DatabaseNotificationManager $databaseNotificationManager |
||
62 | */ |
||
63 | public function setDatabaseNotificationManager(DatabaseNotificationManager $databaseNotificationManager) |
||
67 | |||
68 | /** |
||
69 | * @param NotificationInterface $notification |
||
70 | * @param array | string $broadcasters |
||
71 | * @throws BroadcastException |
||
72 | */ |
||
73 | public function broadcast(NotificationInterface $notification, $broadcasters) |
||
89 | |||
90 | /** |
||
91 | * @param NotificationInterface $notification |
||
92 | * @param $recipients |
||
93 | * @param array $data |
||
94 | */ |
||
95 | public function send(NotificationInterface $notification, $recipients, array $data = []) |
||
116 | |||
117 | /** |
||
118 | * @param DatabaseNotificationInterface $notification |
||
119 | * @return bool |
||
120 | */ |
||
121 | public function markAsRead(DatabaseNotificationInterface $notification) |
||
126 | |||
127 | /** |
||
128 | * @param NotifiableInterface $user |
||
129 | * @return bool |
||
130 | */ |
||
131 | public function markAllAsRead(NotifiableInterface $user) |
||
136 | |||
137 | /** |
||
138 | * @param NotifiableInterface $user |
||
139 | * @return int |
||
140 | */ |
||
141 | public function allNotificationCount(NotifiableInterface $user) |
||
145 | |||
146 | /** |
||
147 | * @param NotifiableInterface $user |
||
148 | * @return int |
||
149 | */ |
||
150 | public function unreadNotificationCount(NotifiableInterface $user) |
||
154 | |||
155 | /** |
||
156 | * @param NotifiableInterface $user |
||
157 | * @return int |
||
158 | */ |
||
159 | public function readNotificationCount(NotifiableInterface $user) |
||
163 | |||
164 | /** |
||
165 | * @param NotifiableInterface $user |
||
166 | * @param string $status |
||
167 | * @return int |
||
168 | */ |
||
169 | public function notificationCount(NotifiableInterface $user, $status = '') |
||
173 | } |
||
174 |