ChangeUserLevel.php 883 B

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