Skip to content

Commit

Permalink
Add custom payload to notification
Browse files Browse the repository at this point in the history
  • Loading branch information
Chafik HADJ ABDOU RAZACK committed Oct 19, 2019
1 parent af98b90 commit eb49f9e
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/vyconsulting-group/push-notifications/PushNotification.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class PushNotification
private $message = null;
private $fields=null;
private $header = null;
private $data = array();
public function __construct($apiKey)
{
$this->key = $apiKey;
Expand All @@ -29,19 +30,23 @@ public function setMessage($title, $body, $vibration, $sound,$priority){
'priority'=>$priority
);
}

public function setData(array $data){
$this->data = $data;
}
public function setField($token){
$this->fields = array(
'to'=>$token,
'notification'=>$this->message
'notification'=>$this->message,
'data'=>$this->data
);

}

public function setFields($tokens){
$this->fields = array(
'registration_ids'=>$tokens,
'notification'=>$this->message
'notification'=>$this->message,
'data'=>$this->data
);

}
Expand Down

0 comments on commit eb49f9e

Please sign in to comment.