DeviceInfo.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?php
  2. namespace App\Model;
  3. use App\Events\DeviceEvent;
  4. use Illuminate\Database\Eloquent\Model;
  5. use Illuminate\Database\Eloquent\SoftDeletes;
  6. use Illuminate\Contracts\Events\Dispatcher;
  7. class DeviceInfo extends Model
  8. {
  9. use SoftDeletes;
  10. //public $dispatcher;
  11. const ONLINE = 0, OFFLINE = 1, DISABLE = 2, UNACTIVE = 3; //在营 离线 禁用 未激活 运行状态 (status)
  12. const BOXFOUR = 1, BOXFIVE = 2; //四箱 五箱
  13. const OK = 0, ERROR = 1; // 正常 故障 设备状态 (runningStatus)
  14. const LOCK = 1, UNLOCK = 0;
  15. protected $table = "device_info";
  16. protected $guarded = [];
  17. /*
  18. *运行状态
  19. */
  20. private static $_status =[
  21. self::ONLINE=>'在营',
  22. self::OFFLINE=>'离线',
  23. self::DISABLE=>'禁用',
  24. self::UNACTIVE=>'未激活',
  25. ];
  26. protected static function getStatus(){
  27. return self::$_status;
  28. }
  29. /*
  30. *是否故障
  31. */
  32. private static $_brakdown =[
  33. self::OK=>'正常',
  34. self::ERROR=>'故障',
  35. ];
  36. protected static function getBrakdown(){
  37. return self::$_status;
  38. }
  39. private static $_types =[
  40. self::BOXFOUR=>'四箱',
  41. self::BOXFIVE=>'五箱',
  42. ];
  43. protected static function getTypes(){
  44. return self::$_types;
  45. }
  46. /*
  47. *是否关锁
  48. */
  49. private static $_islock = [
  50. self::UNLOCK=>'否',
  51. self::LOCK=>'是',
  52. ];
  53. protected static function getLock(){
  54. return self::$_islock;
  55. }
  56. protected $dispatchesEvents = [
  57. 'updated'=>DeviceEvent::class
  58. ];
  59. }