Skip to content

Commit

Permalink
Merge pull request #38 from laravel-notification-channels/send-to-use…
Browse files Browse the repository at this point in the history
…r-devices

Allowed to send push to all user's devices
  • Loading branch information
alexsoft authored Sep 14, 2020
2 parents f7c4661 + 628978f commit d0c4a93
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 4 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,14 @@ public function routeNotificationForPushbullet()
}
```

#### Sending notification to all of the user's devices
```php
public function routeNotificationForPushbullet()
{
return new \NotificationChannels\Pushbullet\Targets\UserDevices();
}
```

### `via` Method
On notification entity just add `\NotificationChannels\Pushbullet\PushbulletChannel::class` item to array that is returned from `via` method.

Expand Down
2 changes: 1 addition & 1 deletion src/Targets/Channel.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function __construct($channelTag)
/**
* {@inheritdoc}
*/
public function getTarget()
public function getTarget(): array
{
return ['channel_tag' => $this->channelTag];
}
Expand Down
2 changes: 1 addition & 1 deletion src/Targets/Device.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function __construct($device)
/**
* {@inheritdoc}
*/
public function getTarget()
public function getTarget(): array
{
return ['device_iden' => $this->deviceId];
}
Expand Down
2 changes: 1 addition & 1 deletion src/Targets/Email.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function __construct($email)
/**
* {@inheritdoc}
*/
public function getTarget()
public function getTarget(): array
{
return ['email' => $this->email];
}
Expand Down
2 changes: 1 addition & 1 deletion src/Targets/Targetable.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ interface Targetable
*
* @return array
*/
public function getTarget();
public function getTarget(): array;
}
13 changes: 13 additions & 0 deletions src/Targets/UserDevices.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

declare(strict_types=1);

namespace NotificationChannels\Pushbullet\Targets;

class UserDevices implements Targetable
{
public function getTarget(): array
{
return [];
}
}

0 comments on commit d0c4a93

Please sign in to comment.