PHP code example of kielabokkie / aws-pinpoint-laravel-notification-channel
1. Go to this page and download the library: Download kielabokkie/aws-pinpoint-laravel-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/ */
kielabokkie / aws-pinpoint-laravel-notification-channel example snippets
namespace App\Notifications;
use App\User;
use Illuminate\Notifications\Notification;
use NotificationChannels\AwsPinpoint\AwsPinpointChannel;
use NotificationChannels\AwsPinpoint\AwsPinpointSmsMessage;
class PhoneVerificationCreated extends Notification
{
/**
* Get the notification's delivery channels.
*
* @param \App\User $notifiable
* @return array
*/
public function via(User $notifiable)
{
return [AwsPinpointChannel::class];
}
/**
* Send SMS via AWS Pinpoint.
*
* @param \App\User $notifiable
* @return \NotificationChannels\AwsPinpoint\AwsPinpointSmsMessage
*/
public function toAwsPinpoint(User $notifiable)
{
$message = sprintf('Your order %s has been dispatched', $this->orderId);
return (new AwsPinpointSmsMessage($message))
->setRecipients($notifiable->mobile_number);
}
}