Skip to content

Commit 177d496

Browse files
author
Alexey Plekhanov
committed
Add ability to send push to channel tag
1 parent 8ca8b93 commit 177d496

File tree

2 files changed

+43
-2
lines changed

2 files changed

+43
-2
lines changed

README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,18 @@ public function routeNotificationForPushbullet()
8282
}
8383
```
8484

85-
#### Third option:
86-
Although, this option is not recommended, you might just return a string (email or device id) and library will do its best to determine if it email or device id.
85+
#### Sending notification to all subscribers of channel that has tag:
86+
```php
87+
public function routeNotificationForPushbullet()
88+
{
89+
return new \NotificationChannels\Pushbullet\Targets\Channel($this->channel_tag);
90+
}
91+
```
92+
93+
#### Fourth option (**deprecated**):
94+
Although, this option is not recommended, you might just return a string (email or device id) and library will do its best to determine if it is email or device id.
95+
96+
**Warning!** This option doesn't give you possibility to have channel tag guessed, only email or device id.
8797
```php
8898
public function routeNotificationForPushbullet()
8999
{

src/Targets/Channel.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
namespace NotificationChannels\Pushbullet\Targets;
4+
5+
class Channel implements Targetable
6+
{
7+
/**
8+
* PushBullet channel tag
9+
*
10+
* @var string
11+
*/
12+
protected $channelTag;
13+
14+
/**
15+
* Set channel tag
16+
*
17+
* @param string $channelTag
18+
*/
19+
public function __construct($channelTag)
20+
{
21+
$this->channelTag = $channelTag;
22+
}
23+
24+
/**
25+
* {@inheritdoc}
26+
*/
27+
public function getTarget()
28+
{
29+
return ['channel_tag' => $this->channelTag];
30+
}
31+
}

0 commit comments

Comments
 (0)