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

Commit 5e6c384

Browse files
committed
feat: Setting push options in message
1 parent f9fff03 commit 5e6c384

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

src/Channel.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ public function send($notifiable, Notification $notification)
4343
$payload = new PushPayload($this->client->push());
4444
$payload->make($to);
4545
$payload->make($message);
46-
$payload->options([]);
4746

4847
try {
4948
$payload->send();

src/Message.php

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ class Message implements Contracts\PushPayloadMakeable
2828
*/
2929
protected $notifications = [];
3030

31+
/**
32+
* Push options.
33+
* @var array
34+
*/
35+
protected $options = [];
36+
3137
/**
3238
* Create a push message.
3339
* @param null|string $alert
@@ -79,6 +85,17 @@ public function setNotification(string $platform, string $alert, array $options
7985
return $this;
8086
}
8187

88+
/**
89+
* Set push options.
90+
* @param array $options
91+
*/
92+
public function setOptions(array $options)
93+
{
94+
$this->options = $options;
95+
96+
return $this;
97+
}
98+
8299
/**
83100
* Make send params.
84101
* @param \Medz\Laravel\Notifications\JPush\PushPayload $payload
@@ -113,7 +130,8 @@ public function make(PushPayload $payload)
113130
break;
114131
}
115132
}
133+
$payload->options($this->options);
116134

117-
return $payload;
135+
return $this;
118136
}
119137
}

0 commit comments

Comments
 (0)