Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function sendPushTopic($data, $key = false, $topic, $id = false)
- {
- $message = CloudMessage::withTarget("topic", $topic)
- ->withNotification(Notification::create($data['title'], $data['body']))
- ->withApnsConfig(
- [
- 'headers' => [
- 'apns-priority' => '10'
- ],
- 'payload' => [
- 'aps' => [
- 'alert' => [
- 'title' => $data['title'],
- 'body' => $data['body'],
- ],
- 'badge' => 1,
- ],
- ],
- ]
- )
- ->withAndroidConfig([
- 'ttl' => '3600s',
- 'priority' => 'normal',
- 'notification' => [
- 'title' => $data['title'],
- 'body' => $data['body'],
- 'icon' => 'https://cabinet.evpoint.md/img/logo_b.png?width=40&height=40',
- 'color' => '#6bba82',
- 'sound' => 'bingbong.aiff'
- ],
- ])
- ->withData(['key' => $key, 'id' => $id]);
- try {
- return $this->messaging->send($message);
- } catch (Exception $e) {
- return $e;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment