1 | <?php |
||
2 | |||
3 | namespace NotificationChannels\Apn; |
||
4 | |||
5 | use Illuminate\Notifications\Notification; |
||
6 | |||
7 | class ApnVoipChannel extends ApnChannel |
||
8 | { |
||
9 | /** |
||
10 | * Send the notification to Apple Push Notification Service. |
||
11 | * |
||
12 | * @param mixed $notifiable |
||
13 | * @param \Illuminate\Notifications\Notification $notification |
||
14 | * @return array|void |
||
15 | */ |
||
16 | 3 | View Code Duplication | public function send($notifiable, Notification $notification) |
17 | { |
||
18 | 3 | $tokens = (array) $notifiable->routeNotificationFor('apn_voip', $notification); |
|
19 | |||
20 | 3 | if (empty($tokens)) { |
|
21 | return; |
||
22 | } |
||
23 | |||
24 | 3 | $message = $notification->toApnVoip($notifiable); |
|
25 | |||
26 | 3 | $client = $message->client ?? $this->factory->instance(); |
|
27 | |||
28 | 3 | $responses = $this->sendNotifications($client, $message, $tokens); |
|
29 | |||
30 | 3 | $this->dispatchEvents($notifiable, $notification, $responses); |
|
31 | |||
32 | 3 | return $responses; |
|
33 | } |
||
34 | } |
||
35 |