Browse Source

some chang in notif helper class and SocketNotification.php message

mahdi
mahdihty 4 years ago
parent
commit
5dc7407dda
  1. 4
      app/Notifications/SocketNotification.php
  2. 6
      app/Utilities/HelperClass/NotificationHelper.php
  3. 4
      routes/api.php

4
app/Notifications/SocketNotification.php

@ -45,8 +45,8 @@ class SocketNotification extends Notification
{ {
return (new SocketMessage()) return (new SocketMessage())
->data([ ->data([
'title' => $this->message['title'],
'body' => $this->message['body'],
'message' => $this->message['message'],
'payload' => $this->message['payload'],
]); ]);
} }
} }

6
app/Utilities/HelperClass/NotificationHelper.php

@ -65,7 +65,7 @@ class NotificationHelper
public function sendNotifications($users, $level = null) { public function sendNotifications($users, $level = null) {
switch ($level) { switch ($level) {
case "emergency": case "emergency":
Notification::send($users, new SmsNotification($this->sms_notif, 'ultraFastSend'));
Notification::send($users, new SmsNotification($this->sms_notif, enum('sms.types.ultra_fast_send.name')));
case "critical": case "critical":
Notification::send($users, new MailNotification($this->notif)); Notification::send($users, new MailNotification($this->notif));
case "high": case "high":
@ -73,10 +73,10 @@ class NotificationHelper
case "medium": case "medium":
Notification::send($users, new FcmNotification($this->notif)); Notification::send($users, new FcmNotification($this->notif));
case "low": case "low":
Notification::send($users, new SocketNotification($this->notif));
// Notification::send($users, new SocketNotification($this->notif));
break; break;
default: default:
Notification::send($users, new SocketNotification($this->notif));
// Notification::send($users, new SocketNotification($this->notif));
} }
} }

4
routes/api.php

@ -9,8 +9,8 @@ $router->get('/lab', function () {
$router->get('/ntest', function () { $router->get('/ntest', function () {
$user = \App\Models\User::find(1); $user = \App\Models\User::find(1);
\Illuminate\Support\Facades\Notification::send($user, new \App\Notifications\SmsNotification(['verification_code' => "1234"])); \Illuminate\Support\Facades\Notification::send($user, new \App\Notifications\SmsNotification(['verification_code' => "1234"]));
(new \App\Utilities\HelperClass\NotificationHelper())
->makeSmsNotif('template_name', ['user' => 'myUser', 'business' => 'myBusiness']);
// (new \App\Utilities\HelperClass\NotificationHelper())
// ->makeSmsNotif('template_name', ['user' => 'myUser', 'business' => 'myBusiness']);
})->middleware('bindBusiness'); })->middleware('bindBusiness');
$router->group(['prefix' => 'actions'], function () use ($router) { $router->group(['prefix' => 'actions'], function () use ($router) {
$router->group(['prefix' => 'businesses'], function () use ($router) { $router->group(['prefix' => 'businesses'], function () use ($router) {

Loading…
Cancel
Save