ProfitEvent.php 840 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. namespace app\common\events;
  3. use Illuminate\Broadcasting\Channel;
  4. use Illuminate\Queue\SerializesModels;
  5. use Illuminate\Broadcasting\PrivateChannel;
  6. use Illuminate\Broadcasting\PresenceChannel;
  7. use Illuminate\Broadcasting\InteractsWithSockets;
  8. use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
  9. class ProfitEvent
  10. {
  11. use InteractsWithSockets, SerializesModels;
  12. protected $data;
  13. /**
  14. * Create a new event instance.
  15. *
  16. * @return void
  17. */
  18. public function __construct(array &$data)
  19. {
  20. $this->data = &$data;
  21. }
  22. public function getDataModel(){
  23. return $this->data;
  24. }
  25. /**
  26. * Get the channels the event should broadcast on.
  27. *
  28. * @return Channel|array
  29. */
  30. public function broadcastOn()
  31. {
  32. return new PrivateChannel('channel-name');
  33. }
  34. }