<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
multicaret / unifonic-notification-channel example snippets
namespace App\Notifications;
use Illuminate\Notifications\Notification;
use Multicaret\Notifications\Messages\UnifonicMessage;
class InvoicePaid extends Notification
{
private $message;
/**
* Create a new notification instance.
*
* @param $message
*/
public function __construct($message)
{
$this->message = $message;
}
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
* @return array
*/
public function via($notifiable)
{
return [
'unifonic',
];
}
/**
* Get the text message representation of the notification
*
* @param mixed $notifiable
*
* @return UnifonicMessage
*/
public function toUnifonic($notifiable)
{
return (new UnifonicMessage())
->content($this->message);
}
}
public function toUnifonic($notifiable)
{
return new UnifonicMessage('Laravel notifications are awesome!');
}
/**
* Route notifications for the Unifonic channel.
*
* @param \Illuminate\Notifications\Notification $notification
*
* @return string
*/
public function routeNotificationForUnifonic($notification)
{
return $this->phone; // where phone is the column within your, let's say, users table.
}
Notification::route('unifonic', 'xxxxx')
->notify(
new \App\Notifications\InvoicePaid('Laravel notifications are awesome!')
);
// where xxxxx is the phone number you want to sent to,
// i.e: 1xxxxxxx - NO NEED for _00_ or _+_
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.