@@ 299-317 (lines=19) @@ | ||
296 | * |
|
297 | * @return array |
|
298 | */ |
|
299 | public function toiOS() |
|
300 | { |
|
301 | $message = [ |
|
302 | 'apns' => [ |
|
303 | 'aps' => [ |
|
304 | 'alert' => [ |
|
305 | 'title' => $this->title, |
|
306 | 'body' => $this->body, |
|
307 | ], |
|
308 | 'sound' => $this->sound, |
|
309 | 'badge' => $this->badge, |
|
310 | ], |
|
311 | ], |
|
312 | ]; |
|
313 | ||
314 | $this->formatMessage($message); |
|
315 | ||
316 | return $message; |
|
317 | } |
|
318 | ||
319 | /** |
|
320 | * Format the message for Android. |
|
@@ 324-340 (lines=17) @@ | ||
321 | * |
|
322 | * @return array |
|
323 | */ |
|
324 | public function toAndroid() |
|
325 | { |
|
326 | $message = [ |
|
327 | 'fcm' => [ |
|
328 | 'notification' => array_filter([ |
|
329 | 'title' => $this->title, |
|
330 | 'body' => $this->body, |
|
331 | 'sound' => $this->sound, |
|
332 | 'icon' => $this->icon, |
|
333 | ]), |
|
334 | ], |
|
335 | ]; |
|
336 | ||
337 | $this->formatMessage($message); |
|
338 | ||
339 | return $message; |
|
340 | } |
|
341 | ||
342 | /** |
|
343 | * Format the message for web. |
|
@@ 347-363 (lines=17) @@ | ||
344 | * |
|
345 | * @return array |
|
346 | */ |
|
347 | public function toWeb() |
|
348 | { |
|
349 | $message = [ |
|
350 | 'web' => [ |
|
351 | 'notification' => array_filter([ |
|
352 | 'title' => $this->title, |
|
353 | 'body' => $this->body, |
|
354 | 'sound' => $this->sound, |
|
355 | 'icon' => $this->icon, |
|
356 | ]), |
|
357 | ], |
|
358 | ]; |
|
359 | ||
360 | $this->formatMessage($message); |
|
361 | ||
362 | return $message; |
|
363 | } |
|
364 | ||
365 | /** |
|
366 | * Return the current platform. |