You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1.1 KiB

  1. <?php
  2. namespace App\Events;
  3. use Illuminate\Broadcasting\Channel;
  4. use Illuminate\Queue\SerializesModels;
  5. use Illuminate\Broadcasting\PrivateChannel;
  6. use Illuminate\Broadcasting\PresenceChannel;
  7. use Illuminate\Foundation\Events\Dispatchable;
  8. use Illuminate\Broadcasting\InteractsWithSockets;
  9. use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
  10. use App\Team, App\Mission;
  11. class ScoreUpdatedEvent implements ShouldBroadcast
  12. {
  13. use Dispatchable, InteractsWithSockets, SerializesModels;
  14. public $team_slug;
  15. public $mission_slug;
  16. public $score;
  17. public $complete;
  18. public $team_score;
  19. /**
  20. * Create a new event instance.
  21. *
  22. * @return void
  23. */
  24. public function __construct(Team $team, Mission $mission, $score, $complete, $team_score)
  25. {
  26. $this->team_slug = $team->slug;
  27. $this->mission_slug = $mission->slug;
  28. $this->score = $score;
  29. $this->complete = $complete;
  30. $this->team_score = $team_score;
  31. }
  32. /**
  33. * Get the channels the event should broadcast on.
  34. *
  35. * @return Channel|array
  36. */
  37. public function broadcastOn()
  38. {
  39. return ['score'];
  40. }
  41. }