Provides a Notification Channel for WebSms
You can install it using Composer:
composer require hebinet/laravel-websms-notification-channel
Then publish the config file of the package.
php artisan vendor:publish --provider="Hebinet\Notifications\WebSmsChannelServiceProvider" --tag=config
If a notification supports being sent as an SMS, you should define a toWebsms
method on the notification class.
This method will receive a $notifiable
entity and should return a string
with the content of the SMS:
/**
* Get the WebSMS / SMS representation of the notification.
*
* @param mixed $notifiable
* @return string
*/
public function toWebsms($notifiable)
{
return 'Your SMS message content';
}
To route Nexmo notifications to the proper phone number,
define a routeNotificationForWebsms
method on your notifiable entity:
<?php
namespace App;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable
{
use Notifiable;
/**
* Route notifications for the WebSms channel.
*
* @param \Illuminate\Notifications\Notification $notification
* @return string
*/
public function routeNotificationForWebsms($notification)
{
return $this->phone_number;
}
}
Please see CONTRIBUTING for details.
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.