Device.php 1.2 KB

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