|
|
@ -8,11 +8,14 @@ use App\Notifications\DBNotification; |
|
|
|
use App\Notifications\FcmNotification; |
|
|
|
use App\Notifications\MailNotification; |
|
|
|
use App\Notifications\SocketNotification; |
|
|
|
use App\Notifications\SmsNotification; |
|
|
|
use Illuminate\Support\Facades\Notification; |
|
|
|
|
|
|
|
class NotificationHelper |
|
|
|
{ |
|
|
|
protected $notif; |
|
|
|
|
|
|
|
protected $sms_notif; |
|
|
|
/** |
|
|
|
* Make notification object |
|
|
|
* |
|
|
@ -33,6 +36,12 @@ class NotificationHelper |
|
|
|
return $this; |
|
|
|
} |
|
|
|
|
|
|
|
public function makeSmsNotif($template_name, $options = []) |
|
|
|
{ |
|
|
|
$this->sms_notif = __('notification.sms.templates.'.$template_name, $options); |
|
|
|
return $this; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Fetch message from notifications lang file |
|
|
|
* |
|
|
@ -56,7 +65,7 @@ class NotificationHelper |
|
|
|
public function sendNotifications($users, $level = null) { |
|
|
|
switch ($level) { |
|
|
|
case "emergency": |
|
|
|
// Notification::send($users, new SmsNotification($notif));
|
|
|
|
Notification::send($users, new SmsNotification($this->sms_notif, 'ultraFastSend')); |
|
|
|
case "critical": |
|
|
|
Notification::send($users, new MailNotification($this->notif)); |
|
|
|
case "high": |
|
|
|