PHP code example of hexters / esms-notification-channel
1. Go to this page and download the library: Download hexters/esms-notification-channel library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
hexters / esms-notification-channel example snippets
. . .
Class User extends Authenticatable {
. . .
public function routeNotificationForEsms($notification) {
return $this->phone;
}
. . .
namespace App\Notifications;
. . .
use Hexters\Esms\EsmsChannel;
use Hexters\Esms\EsmsMessage;
. . .
class InvoicePaid extends Notification {
. . .
/**
* Get the notification channels.
*
* @param mixed $notifiable
* @return array|string
*/
public function via($notifiable) {
return ['mail', EsmsChannel::class];
}
. . .
/**
* Get the voice representation of the notification.
*
* @param mixed $notifiable
* @return EsmsResponse
*/
public function toEsms($notifiable) {
return (new EsmsMessage)->content('Your SMS message content');
}