-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
63 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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)); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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... | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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; | ||
|
@@ -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. | ||
} | ||
|
||
/** | ||
|
@@ -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') | ||
|
@@ -91,6 +96,13 @@ public function toMail($notifiable){ | |
|
||
} | ||
|
||
|
||
public function toSms($notifiable){ | ||
dddx($notifiable); | ||
} | ||
|
||
|
||
|
||
/** | ||
* Get the array representation of the notification. | ||
* | ||
|