46 lines
1.1 KiB
PHP
46 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Events;
|
|
|
|
use Illuminate\Broadcasting\Channel;
|
|
use Illuminate\Broadcasting\InteractsWithSockets;
|
|
use Illuminate\Broadcasting\PresenceChannel;
|
|
use Illuminate\Broadcasting\PrivateChannel;
|
|
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
|
|
use Illuminate\Foundation\Events\Dispatchable;
|
|
use Illuminate\Queue\SerializesModels;
|
|
|
|
class LocationUpdate
|
|
{
|
|
use Dispatchable, InteractsWithSockets, SerializesModels;
|
|
|
|
public $kurirId;
|
|
public $latitude;
|
|
public $longitude;
|
|
|
|
/**
|
|
* Create a new event instance.
|
|
*/
|
|
public function __construct($kurirId, $latitude, $longitude)
|
|
{
|
|
$this->kurirId = $kurirId;
|
|
$this->latitude = $latitude;
|
|
$this->longitude = $longitude;
|
|
}
|
|
|
|
/**
|
|
* Get the channels the event should broadcast on.
|
|
*
|
|
* @return array<int, \Illuminate\Broadcasting\Channel>
|
|
*/
|
|
public function broadcastOn(): array
|
|
{
|
|
return new \Illuminate\Broadcasting\Channel('kurir-location');
|
|
}
|
|
|
|
public function broadcastAs()
|
|
{
|
|
return 'location.updated';
|
|
}
|
|
}
|