| @@ 318-336 (lines=19) @@ | ||
| 315 | * |
|
| 316 | * @return array |
|
| 317 | */ |
|
| 318 | public function toiOS() |
|
| 319 | { |
|
| 320 | $message = [ |
|
| 321 | 'apns' => [ |
|
| 322 | 'aps' => [ |
|
| 323 | 'alert' => [ |
|
| 324 | 'title' => $this->title, |
|
| 325 | 'body' => $this->body, |
|
| 326 | ], |
|
| 327 | 'sound' => $this->sound, |
|
| 328 | 'badge' => $this->badge, |
|
| 329 | ], |
|
| 330 | ], |
|
| 331 | ]; |
|
| 332 | ||
| 333 | $this->formatMessage($message); |
|
| 334 | ||
| 335 | return $message; |
|
| 336 | } |
|
| 337 | ||
| 338 | /** |
|
| 339 | * Format the message for Android. |
|
| @@ 343-359 (lines=17) @@ | ||
| 340 | * |
|
| 341 | * @return array |
|
| 342 | */ |
|
| 343 | public function toAndroid() |
|
| 344 | { |
|
| 345 | $message = [ |
|
| 346 | 'fcm' => [ |
|
| 347 | 'notification' => array_filter([ |
|
| 348 | 'title' => $this->title, |
|
| 349 | 'body' => $this->body, |
|
| 350 | 'sound' => $this->sound, |
|
| 351 | 'icon' => $this->icon, |
|
| 352 | ]), |
|
| 353 | ], |
|
| 354 | ]; |
|
| 355 | ||
| 356 | $this->formatMessage($message); |
|
| 357 | ||
| 358 | return $message; |
|
| 359 | } |
|
| 360 | ||
| 361 | /** |
|
| 362 | * Format the message for web. |
|
| @@ 366-383 (lines=18) @@ | ||
| 363 | * |
|
| 364 | * @return array |
|
| 365 | */ |
|
| 366 | public function toWeb() |
|
| 367 | { |
|
| 368 | $message = [ |
|
| 369 | 'web' => [ |
|
| 370 | 'notification' => array_filter([ |
|
| 371 | 'title' => $this->title, |
|
| 372 | 'body' => $this->body, |
|
| 373 | 'sound' => $this->sound, |
|
| 374 | 'icon' => $this->icon, |
|
| 375 | 'deep_link' => $this->link, |
|
| 376 | ]), |
|
| 377 | ], |
|
| 378 | ]; |
|
| 379 | ||
| 380 | $this->formatMessage($message); |
|
| 381 | ||
| 382 | return $message; |
|
| 383 | } |
|
| 384 | ||
| 385 | /** |
|
| 386 | * Return the current platform. |
|