Skip to content

Commit ad8e79b

Browse files
committed
- Added new Custom WebSms Events instead of builtin Notification Events
1 parent 56ae14c commit ad8e79b

File tree

4 files changed

+33
-3
lines changed

4 files changed

+33
-3
lines changed

src/Channels/WebSmsChannel.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
namespace Hebinet\Notifications\Channels;
44

5+
use Hebinet\Notifications\Events\WebSmsFailed;
6+
use Hebinet\Notifications\Events\WebSmsSending;
7+
use Hebinet\Notifications\Events\WebSmsSent;
58
use Illuminate\Notifications\Events\NotificationFailed;
69
use Illuminate\Notifications\Events\NotificationSending;
710
use Illuminate\Notifications\Events\NotificationSent;
@@ -79,17 +82,17 @@ public function send($notifiable, Notification $notification)
7982

8083
$response = null;
8184
try {
82-
event(new NotificationSending($notifiable, $notification, $this->channelName));
85+
event(new WebSmsSending($notifiable, $notification, $this->channelName));
8386

8487
$response = $client->send($message, $this->getSmsCount($message->getMessageContent()));
8588

86-
event(new NotificationSent($notifiable, $notification, $this->channelName, [
89+
event(new WebSmsSent($notifiable, $notification, $this->channelName, [
8790
'to' => $to,
8891
'message' => $message,
8992
'response' => $response
9093
]));
9194
} catch (\Exception $e) {
92-
event(new NotificationFailed($notifiable, $notification, $this->channelName, [
95+
event(new WebSmsFailed($notifiable, $notification, $this->channelName, [
9396
'to' => $to,
9497
'message' => $message,
9598
'exception' => $e

src/Events/WebSmsFailed.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
3+
namespace Hebinet\Notifications\Events;
4+
5+
use Illuminate\Notifications\Events\NotificationFailed;
6+
7+
class WebSmsFailed extends NotificationFailed
8+
{
9+
}

src/Events/WebSmsSending.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
3+
namespace Hebinet\Notifications\Events;
4+
5+
use Illuminate\Notifications\Events\NotificationSending;
6+
7+
class WebSmsSending extends NotificationSending
8+
{
9+
}

src/Events/WebSmsSent.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
3+
namespace Hebinet\Notifications\Events;
4+
5+
use Illuminate\Notifications\Events\NotificationSent;
6+
7+
class WebSmsSent extends NotificationSent
8+
{
9+
}

0 commit comments

Comments
 (0)