Skip to content
This repository has been archived by the owner on Feb 23, 2023. It is now read-only.

Commit

Permalink
feat: Setting push options in message
Browse files Browse the repository at this point in the history
  • Loading branch information
medz committed Feb 21, 2019
1 parent f9fff03 commit 5e6c384
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
1 change: 0 additions & 1 deletion src/Channel.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ public function send($notifiable, Notification $notification)
$payload = new PushPayload($this->client->push());
$payload->make($to);
$payload->make($message);
$payload->options([]);

try {
$payload->send();
Expand Down
20 changes: 19 additions & 1 deletion src/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ class Message implements Contracts\PushPayloadMakeable
*/
protected $notifications = [];

/**
* Push options.
* @var array
*/
protected $options = [];

/**
* Create a push message.
* @param null|string $alert
Expand Down Expand Up @@ -79,6 +85,17 @@ public function setNotification(string $platform, string $alert, array $options
return $this;
}

/**
* Set push options.
* @param array $options
*/
public function setOptions(array $options)
{
$this->options = $options;

return $this;
}

/**
* Make send params.
* @param \Medz\Laravel\Notifications\JPush\PushPayload $payload
Expand Down Expand Up @@ -113,7 +130,8 @@ public function make(PushPayload $payload)
break;
}
}
$payload->options($this->options);

return $payload;
return $this;
}
}

0 comments on commit 5e6c384

Please sign in to comment.