Skip to content

Commit d0c4a93

Browse files
authored
Merge pull request #38 from laravel-notification-channels/send-to-user-devices
Allowed to send push to all user's devices
2 parents f7c4661 + 628978f commit d0c4a93

File tree

6 files changed

+25
-4
lines changed

6 files changed

+25
-4
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,14 @@ public function routeNotificationForPushbullet()
8484
}
8585
```
8686

87+
#### Sending notification to all of the user's devices
88+
```php
89+
public function routeNotificationForPushbullet()
90+
{
91+
return new \NotificationChannels\Pushbullet\Targets\UserDevices();
92+
}
93+
```
94+
8795
### `via` Method
8896
On notification entity just add `\NotificationChannels\Pushbullet\PushbulletChannel::class` item to array that is returned from `via` method.
8997

src/Targets/Channel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function __construct($channelTag)
2424
/**
2525
* {@inheritdoc}
2626
*/
27-
public function getTarget()
27+
public function getTarget(): array
2828
{
2929
return ['channel_tag' => $this->channelTag];
3030
}

src/Targets/Device.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function __construct($device)
2424
/**
2525
* {@inheritdoc}
2626
*/
27-
public function getTarget()
27+
public function getTarget(): array
2828
{
2929
return ['device_iden' => $this->deviceId];
3030
}

src/Targets/Email.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function __construct($email)
3030
/**
3131
* {@inheritdoc}
3232
*/
33-
public function getTarget()
33+
public function getTarget(): array
3434
{
3535
return ['email' => $this->email];
3636
}

src/Targets/Targetable.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ interface Targetable
99
*
1010
* @return array
1111
*/
12-
public function getTarget();
12+
public function getTarget(): array;
1313
}

src/Targets/UserDevices.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace NotificationChannels\Pushbullet\Targets;
6+
7+
class UserDevices implements Targetable
8+
{
9+
public function getTarget(): array
10+
{
11+
return [];
12+
}
13+
}

0 commit comments

Comments
 (0)