CommentAdded.php 811 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. namespace App\Events;
  3. use Illuminate\Broadcasting\Channel;
  4. use Illuminate\Broadcasting\InteractsWithSockets;
  5. use Illuminate\Broadcasting\PresenceChannel;
  6. use Illuminate\Broadcasting\PrivateChannel;
  7. use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
  8. use Illuminate\Foundation\Events\Dispatchable;
  9. use Illuminate\Queue\SerializesModels;
  10. class CommentAdded
  11. {
  12. use Dispatchable, InteractsWithSockets, SerializesModels;
  13. /**
  14. * Create a new event instance.
  15. */
  16. public function __construct()
  17. {
  18. //
  19. }
  20. /**
  21. * Get the channels the event should broadcast on.
  22. *
  23. * @return array<int, \Illuminate\Broadcasting\Channel>
  24. */
  25. public function broadcastOn(): array
  26. {
  27. return [
  28. new PrivateChannel('channel-name'),
  29. ];
  30. }
  31. }