ClockinEvent.php 724 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. namespace App\Events;
  3. use App\LaborReport;
  4. use App\UserDutyCheck;
  5. use Illuminate\Broadcasting\Channel;
  6. use Illuminate\Contracts\Broadcasting\ShouldBroadcastNow;
  7. use Illuminate\Queue\SerializesModels;
  8. class ClockinEvent implements ShouldBroadcastNow
  9. {
  10. use SerializesModels;
  11. public $laborReport;
  12. /**
  13. * Create a new event instance.
  14. * @param LaborReport $laborReport
  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. */
  24. public function broadcastOn(): Channel
  25. {
  26. return new Channel($this->laborReport->userWorkgroup->token);
  27. }
  28. }