|
1 |
| -# new-channels |
| 1 | +# Exponent push notifications channel for Laravel 5.3 |
2 | 2 |
|
3 |
| -Discuss about new channel proposals our share your finished channels in the [proposal issue](https://github.com/laravel-notification-channels/new-channels/issues/6). |
| 3 | +[](https://packagist.org/packages/alymosul/laravel-exponent-push-notifications) |
| 4 | +[](LICENSE.md) |
| 5 | +[](https://travis-ci.org/Alymosul/laravel-exponent-push-notifications) |
| 6 | +[](https://styleci.io/repos/96645200) |
| 7 | +[](https://insight.sensiolabs.com/projects/:sensio_labs_id) |
| 8 | +[](https://scrutinizer-ci.com/g/alymosul/laravel-exponent-push-notifications) |
| 9 | +[](https://scrutinizer-ci.com/g/alymosul/laravel-exponent-push-notifications/?branch=master) |
| 10 | +[](https://packagist.org/packages/alymosul/laravel-exponent-push-notifications) |
4 | 11 |
|
5 |
| -Take a look at our [FAQ](http://laravel-notification-channels.com/) to see our small list of rules, to provide top-notch notification channels. |
| 12 | +## Contents |
| 13 | + |
| 14 | +- [Installation](#installation) |
| 15 | +- [Usage](#usage) |
| 16 | + - [Available Message methods](#available-message-methods) |
| 17 | +- [Changelog](#changelog) |
| 18 | +- [Testing](#testing) |
| 19 | +- [Security](#security) |
| 20 | +- [Contributing](#contributing) |
| 21 | +- [Credits](#credits) |
| 22 | +- [License](#license) |
| 23 | + |
| 24 | + |
| 25 | +## Installation |
| 26 | +You can install the package via composer: |
| 27 | +```bash |
| 28 | +composer require laravel-notification-channels/exponent-push-notifications |
| 29 | +``` |
| 30 | +You must install the service provider: |
| 31 | + |
| 32 | +```php |
| 33 | +// config/app.php |
| 34 | +'providers' => [ |
| 35 | + ... |
| 36 | + NotificationChannels\ExpoPushNotifications\ExpoPushNotificationsServiceProvider::class, |
| 37 | +], |
| 38 | +``` |
| 39 | + |
| 40 | +## Usage |
| 41 | + |
| 42 | +``` php |
| 43 | +use NotificationChannels\ExpoPushNotifications\ExpoChannel; |
| 44 | +use NotificationChannels\ExpoPushNotifications\ExpoMessage; |
| 45 | +use Illuminate\Notifications\Notification; |
| 46 | + |
| 47 | +class AccountApproved extends Notification |
| 48 | +{ |
| 49 | + public function via($notifiable) |
| 50 | + { |
| 51 | + return [ExpoChannel::class]; |
| 52 | + } |
| 53 | + |
| 54 | + public function toExpoPush($notifiable) |
| 55 | + { |
| 56 | + return ExpoMessage::create() |
| 57 | + ->badge(1) |
| 58 | + ->enableSound() |
| 59 | + ->body("Your {$notifiable->service} account was approved!"); |
| 60 | + } |
| 61 | +} |
| 62 | +``` |
| 63 | + |
| 64 | +### Available Message methods |
| 65 | + |
| 66 | +A list of all available options |
| 67 | +- `body('')`: Accepts a string value for the body. |
| 68 | +- `enableSound()`: Enables the notification sound. |
| 69 | +- `disableSound()`: Mutes the notification sound. |
| 70 | +- `badge(1)`: Accepts an integer value for the badge. |
| 71 | +- `ttl(60)`: Accepts an integer value for the time to live. |
| 72 | + |
| 73 | +### Managing Recipients |
| 74 | + |
| 75 | +This package registers two endpoints that handle the subscription of recipients, the endpoints are defined in src/Http/routes.php file, used by ExpoController and all loaded through the package service provider. |
| 76 | + |
| 77 | +### Routing a message |
| 78 | + |
| 79 | +By default the exponent "interest" messages will be sent to will be defined using the {notifiable}.{id} convention, for example `App.User.1`, however you can change this behaviour by including a `routeNotificationForExpoPushNotifications()` in the notifiable class method that returns the interest name. |
| 80 | + |
| 81 | +## Changelog |
| 82 | + |
| 83 | +Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently. |
| 84 | + |
| 85 | +## Testing |
| 86 | + |
| 87 | +``` bash |
| 88 | +$ composer test |
| 89 | +``` |
| 90 | + |
| 91 | +## Security |
| 92 | + |
| 93 | +If you discover any security related issues, please email [email protected] instead of using the issue tracker. |
| 94 | + |
| 95 | +## Contributing |
| 96 | + |
| 97 | +Please see [CONTRIBUTING](CONTRIBUTING.md) for details. |
| 98 | + |
| 99 | +## Credits |
| 100 | + |
| 101 | +- [Aly Suleiman](https://github.com/Alymosul) |
| 102 | +- [All Contributors](../../contributors) |
| 103 | + |
| 104 | +## License |
| 105 | + |
| 106 | +The MIT License (MIT). Please see [License File](LICENSE.md) for more information. |
0 commit comments