Skip to content

Commit 54495b6

Browse files
authored
Merge pull request #19 from mai92/master
Fix typo on content_available
2 parents 4cab8a9 + 4d5e5cf commit 54495b6

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/Fcm.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,17 @@ public function send()
4545
{
4646
$fcmEndpoint = 'https://fcm.googleapis.com/fcm/send';
4747

48-
$fields = [
49-
'content-available' => true,
48+
$payloads = [
49+
'content_available' => true,
5050
'priority' => 'high',
5151
'data' => $this->data,
5252
'notification' => $this->notification
5353
];
5454

5555
if ($this->topic) {
56-
$fields['to'] = "/topics/" . $this->topic;
56+
$payloads['to'] = "/topics/{$this->topic}";
5757
} else {
58-
$fields['registration_ids'] = $this->recipient;
58+
$payloads['registration_ids'] = $this->recipient;
5959
}
6060

6161
$serverKey = config('laravel-fcm.server_key');
@@ -71,7 +71,7 @@ public function send()
7171
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
7272
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
7373
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, CURL_IPRESOLVE_V4);
74-
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));
74+
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payloads));
7575
$result = json_decode(curl_exec($ch));
7676
curl_close($ch);
7777

0 commit comments

Comments
 (0)