Device.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. namespace App\Http\Models;
  3. use Illuminate\Database\Eloquent\Model;
  4. /**
  5. * 订阅设备列表
  6. * Class Device
  7. *
  8. * @package App\Http\Models
  9. * @mixin \Eloquent
  10. */
  11. class Device extends Model
  12. {
  13. protected $table = 'device';
  14. protected $primaryKey = 'id';
  15. public $timestamps = false;
  16. function getTypeLabelAttribute()
  17. {
  18. switch ($this->attributes['type']) {
  19. case 1:
  20. $type_label = '<span class="label label-danger"> Shadowsocks(R) </span>';
  21. break;
  22. case 2:
  23. $type_label = '<span class="label label-danger"> V2Ray </span>';
  24. break;
  25. default:
  26. $type_label = '<span class="label label-default"> 其他 </span>';
  27. }
  28. return $type_label;
  29. }
  30. function getPlatformLabelAttribute()
  31. {
  32. switch ($this->attributes['platform']) {
  33. case 1:
  34. $platform_label = '<i class="fa fa-apple"></i> iOS';
  35. break;
  36. case 2:
  37. $platform_label = '<i class="fa fa-android"></i> Android';
  38. break;
  39. case 3:
  40. $platform_label = '<i class="fa fa-apple"></i> Mac';
  41. break;
  42. case 4:
  43. $platform_label = '<i class="fa fa-windows"></i> Windows';
  44. break;
  45. case 5:
  46. $platform_label = '<i class="fa fa-linux"></i> Linux';
  47. break;
  48. case 0:
  49. default:
  50. $platform_label = '其他';
  51. }
  52. return $platform_label;
  53. }
  54. }