1. Go to this page and download the library: Download websms/laravel-notification 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/ */
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
* @return array
*/
public function via($notifiable)
{
return [WebSmsChannel::class];
}
/**
* Get the sms representation of the notification.
*
* @param mixed $notifiable
* @return string
*/
public function toSms($notifiable)
{
$webSmsMessage = new WebSmsMessage();
$webSmsMessage->setFrom(env('WEBSMS_SENDNUMBER'));
$webSmsMessage->setTo($notifiable->routeNotificationFor('sms'));
$webSmsMessage->setMessage($this->message);
return $webSmsMessage;
}
public function routeNotificationForSms()
{
return $this->phone; // where `phone` is a field in your users table;
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.