From 13155b20d71f16c548f069b2b144f2729ea66721 Mon Sep 17 00:00:00 2001 From: Dyego Nery Date: Wed, 8 Aug 2018 10:41:30 -0300 Subject: [PATCH 1/3] Add method to set the template_id of the message --- src/OneSignalMessage.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/OneSignalMessage.php b/src/OneSignalMessage.php index af21d72..c50b85c 100644 --- a/src/OneSignalMessage.php +++ b/src/OneSignalMessage.php @@ -60,6 +60,19 @@ public function setSubject($value) return $this->setParameter('headings', $this->parseValueToArray($value)); } + + /** + * Set the message template_id + * + * @param string $valye + * + * @return $this + */ + public function setTemplate($value) + { + return $this->setParameter('template_id', $value); + } + /** * @param mixed $value * From 48a6ac5725003824cef679cc45504ce06750cdba Mon Sep 17 00:00:00 2001 From: Dyego Nery <4934602+dyegonery@users.noreply.github.com> Date: Wed, 8 Aug 2018 12:11:01 -0300 Subject: [PATCH 2/3] Fix typo on method for setting template --- src/OneSignalMessage.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/OneSignalMessage.php b/src/OneSignalMessage.php index c50b85c..cac4ed6 100644 --- a/src/OneSignalMessage.php +++ b/src/OneSignalMessage.php @@ -64,7 +64,7 @@ public function setSubject($value) /** * Set the message template_id * - * @param string $valye + * @param string $value * * @return $this */ From 06a4de19c4380c2a8c19097eb4d6eea03038e521 Mon Sep 17 00:00:00 2001 From: Dyego Nery <4934602+dyegonery@users.noreply.github.com> Date: Wed, 8 Aug 2018 12:59:15 -0300 Subject: [PATCH 3/3] Remove contents when using a template Remove any contents set by the constructor when using the `setTemplate()` method. --- src/OneSignalMessage.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/OneSignalMessage.php b/src/OneSignalMessage.php index cac4ed6..b548d53 100644 --- a/src/OneSignalMessage.php +++ b/src/OneSignalMessage.php @@ -70,6 +70,7 @@ public function setSubject($value) */ public function setTemplate($value) { + Arr::forget($this->payload, 'contents'); return $this->setParameter('template_id', $value); }