@@ 221-241 (lines=21) @@ | ||
218 | * |
|
219 | * @return array |
|
220 | */ |
|
221 | public function toiOS() |
|
222 | { |
|
223 | $message = [ |
|
224 | 'apns' => [ |
|
225 | 'aps' => [ |
|
226 | 'alert' => [ |
|
227 | 'title' => $this->title, |
|
228 | 'body' => $this->body, |
|
229 | ], |
|
230 | 'sound' => $this->sound, |
|
231 | 'badge' => $this->badge, |
|
232 | ], |
|
233 | ], |
|
234 | ]; |
|
235 | ||
236 | foreach ($this->options as $option => $value) { |
|
237 | Arr::set($message, $option, $value); |
|
238 | } |
|
239 | ||
240 | return $message; |
|
241 | } |
|
242 | ||
243 | /** |
|
244 | * Format the message for Android. |
|
@@ 248-266 (lines=19) @@ | ||
245 | * |
|
246 | * @return array |
|
247 | */ |
|
248 | public function toAndroid() |
|
249 | { |
|
250 | $message = [ |
|
251 | 'gcm' => [ |
|
252 | 'notification' => [ |
|
253 | 'title' => $this->title, |
|
254 | 'body' => $this->body, |
|
255 | 'sound' => $this->sound, |
|
256 | 'icon' => $this->icon, |
|
257 | ], |
|
258 | ], |
|
259 | ]; |
|
260 | ||
261 | foreach ($this->options as $option => $value) { |
|
262 | Arr::set($message, $option, $value); |
|
263 | } |
|
264 | ||
265 | return $message; |
|
266 | } |
|
267 | } |
|
268 |