DataAnomaly.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. namespace App\Notifications;
  3. use Illuminate\Bus\Queueable;
  4. use Illuminate\Contracts\Queue\ShouldQueue;
  5. use Illuminate\Notifications\Messages\MailMessage;
  6. use Illuminate\Notifications\Notification;
  7. class DataAnomaly extends Notification implements ShouldQueue
  8. {
  9. use Queueable;
  10. private $upload;
  11. private $download;
  12. private $total;
  13. public function __construct($id, $upload, $download, $total)
  14. {
  15. $this->id = $id;
  16. $this->upload = $upload;
  17. $this->download = $download;
  18. $this->total = $total;
  19. }
  20. public function via($notifiable)
  21. {
  22. return sysConfig('data_anomaly_notification');
  23. }
  24. public function toMail($notifiable)
  25. {
  26. return (new MailMessage)
  27. ->subject(trans('notification.data_anomaly'))
  28. ->line(trans('notification.data_anomaly', ['id' => $this->id, 'upload' => $this->upload, 'download' => $this->download, 'total' => $this->total]));
  29. }
  30. public function toCustom($notifiable)
  31. {
  32. return [
  33. 'title' => trans('notification.data_anomaly'),
  34. 'content' => trans('notification.data_anomaly', ['id' => $this->id, 'upload' => $this->upload, 'download' => $this->download, 'total' => $this->total]),
  35. ];
  36. }
  37. }