Skip to content

Commit

Permalink
Add example for multicast on routeNotificationForFcm() (#71)
Browse files Browse the repository at this point in the history
  • Loading branch information
gregorip02 authored Nov 26, 2020
1 parent b45ae94 commit 8b95cd0
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class User extends Authenticatable
/**
* Specifies the user's FCM token
*
* @return string
* @return string|array
*/
public function routeNotificationForFcm()
{
Expand All @@ -107,6 +107,27 @@ class User extends Authenticatable
}
```

You can also return an array of tokens to send notifications via multicast to different user devices.

```php
class User extends Authenticatable
{
use Notifiable;

....

/**
* Specifies the user's FCM tokens
*
* @return string|array
*/
public function routeNotificationForFcm()
{
return $this->getDeviceTokens();
}
}
```

Once you have that in place, you can simply send a notification to the user by doing the following:

```php
Expand Down

0 comments on commit 8b95cd0

Please sign in to comment.