RoutineNotification.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. namespace App\Notifications;
  3. use Illuminate\Bus\Queueable;
  4. use Illuminate\Contracts\Queue\ShouldQueue;
  5. use Illuminate\Notifications\Messages\BroadcastMessage;
  6. use Illuminate\Notifications\Notification;
  7. use Illuminate\Support\Facades\Log;
  8. class RoutineNotification extends Notification implements ShouldQueue
  9. {
  10. use Queueable;
  11. /** @var array|mixed $seeLog */
  12. private $seeLog;
  13. public function __construct(array $seeLog)
  14. {
  15. $seeLog["no"] = $seeLog["id"];
  16. unset($seeLog["id"]);
  17. $this->seeLog = $seeLog;
  18. }
  19. /**
  20. * Get the notification's delivery channels.
  21. *
  22. * @param mixed $notifiable
  23. * @return array
  24. */
  25. public function via($notifiable):array
  26. {
  27. return ['broadcast'];
  28. }
  29. /*public function viaQueues():array
  30. {
  31. return [
  32. 'broadcast' => 'notification-broadcast',
  33. ];
  34. }*/
  35. public function broadcastType():string
  36. {
  37. return 'common';
  38. }
  39. public function toBroadcast($notifiable):BroadcastMessage
  40. {
  41. return new BroadcastMessage($this->seeLog);
  42. }
  43. }