From 4d5e5cf8b4ea3818eb5e3702a0c2e30628dfc100 Mon Sep 17 00:00:00 2001 From: Amirul Date: Thu, 9 May 2019 07:47:26 +0700 Subject: [PATCH] Fix typo on content_available --- src/Fcm.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Fcm.php b/src/Fcm.php index 03caaa4..3ce40df 100644 --- a/src/Fcm.php +++ b/src/Fcm.php @@ -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'); @@ -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);