SendTextMessage.php 971 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. namespace App\Events;
  3. use App\Models\SmsLog;
  4. use Illuminate\Queue\SerializesModels;
  5. use Illuminate\Broadcasting\PrivateChannel;
  6. use Illuminate\Foundation\Events\Dispatchable;
  7. use Illuminate\Broadcasting\InteractsWithSockets;
  8. use Illuminate\Support\Facades\Log;
  9. class SendTextMessage
  10. {
  11. use Dispatchable, InteractsWithSockets, SerializesModels;
  12. public $data;
  13. /**
  14. * Create a new event instance.
  15. * 发送短信
  16. * @return void
  17. */
  18. public function __construct($phone, $ip, $code, $content,$type)
  19. {
  20. $this->data = [
  21. 'phone' => $phone,
  22. 'ip_count' => $ip,
  23. 'code' => $code,
  24. 'content' => $content,
  25. 'type' => $type,
  26. ];
  27. }
  28. /**
  29. * Get the channels the event should broadcast on.
  30. *
  31. * @return \Illuminate\Broadcasting\Channel|array
  32. */
  33. public function broadcastOn()
  34. {
  35. return new PrivateChannel('channel-name');
  36. }
  37. }