Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
marco76tv authored and Malebestia committed Sep 4, 2023
1 parent f9713a9 commit 599ba82
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Models/Panels/Actions/TrySendMailAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ public function postHandle() {
$view='notify::emails.samples.ark';
$test=(object)['a'=>'b'];
$users=[
new Notify('mail',['[email protected]','[email protected]']),
//new Notify('mail',['[email protected]','[email protected]']),
new Notify('mail','[email protected]'),
];

Notification::send($users, new TestNotification($test));
Expand Down
48 changes: 48 additions & 0 deletions Notifications/Channels/SmsChannel.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php
/**
* @see https://github.com/laravel/vonage-notification-channel/blob/3.x/src/Channels/VonageSmsChannel.php
*/


namespace Modules\Notify\Notifications\Channels;

use Illuminate\Notifications\Notification;

class SmsChannel {


/**
* The Vonage client instance.
*
* @var \Vonage\Client
*/
protected $client;

/**
* The phone number notifications should be sent from.
*
* @var string
*/
protected $from;



/**
* Send the given notification.
*
* @param mixed $notifiable
* @param \Illuminate\Notifications\Notification $notification
* @return void
*/
public function send($notifiable, Notification $notification) {
//if (! $to = $notifiable->routeNotificationFor('sms', $notification)) {
if (! $to = $notifiable->routeNotificationFor('sms')) {
dddx($to);
return;
}

$message = $notification->toSms($notifiable);

// Send notification to the $notifiable instance...
}
}
14 changes: 13 additions & 1 deletion Notifications/TestNotification.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\AnonymousNotifiable;
use Illuminate\Notifications\Messages\MailMessage;
use Modules\Notify\Notifications\Channels\SmsChannel;

class TestNotification extends Notification {
use Queueable;
Expand All @@ -32,7 +33,10 @@ public function via($notifiable){
//dddx($notifiable->routes);
//

return ['mail'];
//return ['mail'];
//return ['sms']; //Driver [sms] not supported.
return [SmsChannel::class];
//return ['zibibbo'];//Driver [zibibbo] not supported.
}

/**
Expand All @@ -49,6 +53,7 @@ public function toMail($notifiable){
*/
//dddx($notifiable);
return (new MailMessage)
//->to('[email protected]')
// ->from('[email protected]', 'Barrett Blair')
//->subject('Invoice Payment Failed')
//->mailer('postmark')
Expand Down Expand Up @@ -91,6 +96,13 @@ public function toMail($notifiable){

}


public function toSms($notifiable){
dddx($notifiable);
}



/**
* Get the array representation of the notification.
*
Expand Down

0 comments on commit 599ba82

Please sign in to comment.