Files
ProxyPanel/app/Http/Models/Device.php
Bretton 7fa56ada16 2.1 版本
1. 框架更新至5.8,并且其涉及代码进行修改;
2.  对支付的alipay组件针对php7.2/3进行修改;
3. 重构了节点信息获取逻辑;现在为实时请求;
4. 代码小细节和命名规范
2020-08-05 03:20:24 +08:00

80 lines
2.2 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\Http\Models;
use Eloquent;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
/**
* 订阅设备列表
* Class Device
*
* @package App\Http\Models
* @mixin Eloquent
* @property int $id
* @property int $type 类型0-兼容、1-Shadowsocks(R)、2-V2Ray
* @property int $platform 所属平台0-其他、1-iOS、2-Android、3-Mac、4-Windows、5-Linux
* @property string $name 设备名称
* @property int $status 状态0-禁止订阅、1-允许订阅
* @property string $header 请求时头部的识别特征码
* @property-read mixed $platform_label
* @property-read mixed $type_label
* @method static Builder|Device newModelQuery()
* @method static Builder|Device newQuery()
* @method static Builder|Device query()
* @method static Builder|Device whereHeader($value)
* @method static Builder|Device whereId($value)
* @method static Builder|Device whereName($value)
* @method static Builder|Device wherePlatform($value)
* @method static Builder|Device whereStatus($value)
* @method static Builder|Device whereType($value)
*/
class Device extends Model
{
public $timestamps = FALSE;
protected $table = 'device';
protected $primaryKey = 'id';
function getTypeLabelAttribute()
{
switch($this->attributes['type']){
case 1:
$type_label = '<span class="label label-danger"> Shadowsocks(R) </span>';
break;
case 2:
$type_label = '<span class="label label-danger"> V2Ray </span>';
break;
default:
$type_label = '<span class="label label-default"> 其他 </span>';
}
return $type_label;
}
function getPlatformLabelAttribute()
{
switch($this->attributes['platform']){
case 1:
$platform_label = '<i class="fa fa-apple"></i> iOS';
break;
case 2:
$platform_label = '<i class="fa fa-android"></i> Android';
break;
case 3:
$platform_label = '<i class="fa fa-apple"></i> Mac';
break;
case 4:
$platform_label = '<i class="fa fa-windows"></i> Windows';
break;
case 5:
$platform_label = '<i class="fa fa-linux"></i> Linux';
break;
case 0:
default:
$platform_label = '其他';
}
return $platform_label;
}
}