ImportEvent.php 847 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. namespace App\Events;
  3. use App\LaborReport;
  4. use Illuminate\Broadcasting\Channel;
  5. use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
  6. use Illuminate\Queue\SerializesModels;
  7. class ImportEvent implements ShouldBroadcast
  8. {
  9. use SerializesModels;
  10. public $laborReport;
  11. /**
  12. * Create a new event instance.
  13. *
  14. * @return void
  15. */
  16. public function __construct(LaborReport $laborReport)
  17. {
  18. $this->laborReport=$laborReport;
  19. }
  20. /**
  21. * Get the channels the event should broadcast on.
  22. *
  23. * @return \Illuminate\Broadcasting\Channel|array
  24. */
  25. public function broadcastOn()
  26. {
  27. $tokenOfBroadcastEnterAndLeave=LaborReport::tokenOfBroadcastEnterAndLeave();
  28. return new Channel($tokenOfBroadcastEnterAndLeave);
  29. //return new Channel('laborReport');
  30. }
  31. }