dootask/app/Models/WebSocket.php
2021-06-08 10:40:16 +08:00

48 lines
1.5 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
namespace App\Models;
use Request;
/**
* Class WebSocket
*
* @package App\Models
* @property int $id
* @property string $key
* @property string|null $fd
* @property int|null $userid
* @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
* @method static \Illuminate\Database\Eloquent\Builder|WebSocket newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|WebSocket newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|WebSocket query()
* @method static \Illuminate\Database\Eloquent\Builder|WebSocket whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|WebSocket whereFd($value)
* @method static \Illuminate\Database\Eloquent\Builder|WebSocket whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|WebSocket whereKey($value)
* @method static \Illuminate\Database\Eloquent\Builder|WebSocket whereUpdatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|WebSocket whereUserid($value)
* @mixin \Eloquent
*/
class WebSocket extends AbstractModel
{
/**
* 获取其他fd获取其他设备
* @return array
*/
public static function getOtherFd($fd)
{
if (empty($fd)) {
return [];
}
$row = self::whereFd($fd)->first();
if ($row) {
return self::whereUserid($row->userid)->where('id', '!=', $row->id)->pluck('fd')->toArray();
}
return [];
}
}