Skip to content

Instantly share code, notes, and snippets.

@zloadmin
Created March 27, 2020 12:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zloadmin/8dc1dba93348771680ace8c6d5f49885 to your computer and use it in GitHub Desktop.
Save zloadmin/8dc1dba93348771680ace8c6d5f49885 to your computer and use it in GitHub Desktop.
<?php
private function getArrayRequest(string $token, array $data, bool $ios = false): array
{
if ($ios) $this->getIosArrayRequest($token, $data);
return $this->getAndroidArrayRequest($token, $data);
}
private function getIosArrayRequest(string $token, array $data)
{
return [
'notification' => [
'title' => 'title',
'sound' => 'default',
'body' => 'body',
],
'mutable_content' => true,
'to' => $token,
'data' => $data,
];
}
private function getAndroidArrayRequest(string $token, array $data)
{
return [
'to' => $token,
'data' => $data,
];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment