Skip to content

Commit

Permalink
Merge pull request #19 from mai92/master
Browse files Browse the repository at this point in the history
Fix typo on content_available
  • Loading branch information
sayaamirul authored May 9, 2019
2 parents 4cab8a9 + 4d5e5cf commit 54495b6
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Fcm.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,17 @@ public function send()
{
$fcmEndpoint = 'https://fcm.googleapis.com/fcm/send';

$fields = [
'content-available' => true,
$payloads = [
'content_available' => true,
'priority' => 'high',
'data' => $this->data,
'notification' => $this->notification
];

if ($this->topic) {
$fields['to'] = "/topics/" . $this->topic;
$payloads['to'] = "/topics/{$this->topic}";
} else {
$fields['registration_ids'] = $this->recipient;
$payloads['registration_ids'] = $this->recipient;
}

$serverKey = config('laravel-fcm.server_key');
Expand All @@ -71,7 +71,7 @@ public function send()
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, CURL_IPRESOLVE_V4);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payloads));
$result = json_decode(curl_exec($ch));
curl_close($ch);

Expand Down

0 comments on commit 54495b6

Please sign in to comment.