PHP code example of deegitalbe / trustup-pro-notifier
1. Go to this page and download the library: Download deegitalbe/trustup-pro-notifier 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/ */
deegitalbe / trustup-pro-notifier example snippets
return [
/**
* Sets at which URL the notifier is accessible.
* Default value: https://notifier.trustup.io
*/
'url' => env('TPN_URL', 'https://notifier.trustup.io'),
/**
* App name (default, invoicing...).
*/
'app' => env('TPN_APP_NAME', 'default'),
/**
* App key
*/
'key' => env('TPN_APP_KEY')
];
namespace App\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
class DemoNotification extends Notification implements ShouldQueue
{
use Queueable;
public $channels;
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
* @return array
*/
public function via($notifiable)
{
return ['tpn_sms', 'tpn_email', 'tpn_letter', 'tpn_push', 'database'];
}
public function toTPNSMS($notifiable): array
{
return [
'to' => '31657616867',
'text' => 'This is a test SMS'
];
}
public function toTPNEmail($notifiable): array
{
return [
'to' => '[email protected]',
'html' => '<h1>Demo notification</h1><p>This is my email content...</p>',
'plain' => 'This is my email content...',
'subject' => 'Demo notification',
'headers' => [
'X-Model-ID' => 1,
'X-Model-Type' => 'user'
]
];
}
public function toTPNPush($notifiable): array
{
return [
'to' => 'f0TAY_cMSpi2nNnakQ_B0w:APA91bFV1-2sblQS1h9mGn6I_aYJEZtww67fCJXN3Ir7V1179q7z_oHDLipQL1KAFs7meUyveVomzi2wLHTYuzXR7rDDnFiOBmCzGFEx-_aRszH0B2lIIelqzBjEjo5cL2t98bZc3B5g',
'name' => 'demo-notification',
'title' => 'Demo notification',
'body' => 'Lorem ipsum...',
'data' => [
'type' => 'new-request',
'id' => '555'
]
];
}
public function toTPNLetter($notifiable): array
{
return [
'name' => 'demo-notification',
'pdf' => 'https://trustup-dev-billing.ams3.digitaloceanspaces.com/202202-2263%20(5).pdf'
];
}
public function toArray($notifiable)
{
return [
'channels' => $this->via($notifiable),
'to' => '31657616867',
'text' => 'This is a demo notification'
];
}
}