update notification

This commit is contained in:
Mathieu Lagace
2020-07-27 16:41:28 -04:00
parent c16d1e7e95
commit 2d64d6d422
28 changed files with 1167 additions and 47 deletions

View File

@@ -3,6 +3,7 @@
namespace App\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Messages\BroadcastMessage;
use Illuminate\Notifications\Notification;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
@@ -13,6 +14,7 @@ class Alert extends Notification
protected $fromUser;
protected $myNotification;
private $myUrl;
/**
* Create a new notification instance.
@@ -34,7 +36,7 @@ class Alert extends Notification
*/
public function via($notifiable)
{
return ['database'];
return ['database','broadcast'];
}
/**
@@ -51,4 +53,18 @@ class Alert extends Notification
'url' => $this->myUrl,
];
}
public function toBroadcast($notifiable)
{
return new BroadcastMessage([
'from' => $this->fromUser,
'msg' => $this->myNotification,
'url' => $this->myUrl,
]);
}
public function broadcastType()
{
return 'notification.alert';
}
}