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.
54 lines
831 B
54 lines
831 B
<?php
|
|
|
|
|
|
namespace App\Channels\Messages;
|
|
|
|
|
|
class SocketMessage
|
|
{
|
|
/**
|
|
* The devices token to send the message from.
|
|
*
|
|
* @var array|string
|
|
*/
|
|
public $to;
|
|
|
|
/**
|
|
* The data of the Socket message.
|
|
*
|
|
* @var array
|
|
*/
|
|
public $data;
|
|
|
|
|
|
/**
|
|
* Set the devices token to send the message from.
|
|
*
|
|
* @param array|string $to
|
|
* @return $this
|
|
*/
|
|
public function to($to)
|
|
{
|
|
if (is_array($to) && count($to) === 1) {
|
|
$this->to = $to[0];
|
|
} else {
|
|
$this->to = $to;
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* Set the data of the FCM message.
|
|
*
|
|
* @param array $data
|
|
* @return $this
|
|
*/
|
|
public function data(array $data)
|
|
{
|
|
$this->data = $data;
|
|
|
|
return $this;
|
|
}
|
|
|
|
}
|