12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- <?php
- namespace App\Model;
- use App\Events\DeviceEvent;
- use Illuminate\Database\Eloquent\Model;
- use Illuminate\Database\Eloquent\SoftDeletes;
- use Illuminate\Contracts\Events\Dispatcher;
- class DeviceInfo extends Model
- {
- use SoftDeletes;
- //public $dispatcher;
- const ONLINE = 0, OFFLINE = 1, DISABLE = 2, UNACTIVE = 3; //在营 离线 禁用 未激活 运行状态 (status)
- const BOXFOUR = 1, BOXFIVE = 2; //四箱 五箱
- const OK = 0, ERROR = 1; // 正常 故障 设备状态 (runningStatus)
- const LOCK = 1, UNLOCK = 0;
- protected $table = "device_info";
- protected $guarded = [];
- /*
- *运行状态
- */
- private static $_status =[
- self::ONLINE=>'在营',
- self::OFFLINE=>'离线',
- self::DISABLE=>'禁用',
- self::UNACTIVE=>'未激活',
- ];
- protected static function getStatus(){
- return self::$_status;
- }
- /*
- *是否故障
- */
- private static $_brakdown =[
- self::OK=>'正常',
- self::ERROR=>'故障',
- ];
- protected static function getBrakdown(){
- return self::$_status;
- }
- private static $_types =[
- self::BOXFOUR=>'四箱',
- self::BOXFIVE=>'五箱',
- ];
- protected static function getTypes(){
- return self::$_types;
- }
- /*
- *是否关锁
- */
- private static $_islock = [
- self::UNLOCK=>'否',
- self::LOCK=>'是',
- ];
- protected static function getLock(){
- return self::$_islock;
- }
- protected $dispatchesEvents = [
- 'updated'=>DeviceEvent::class
- ];
-
- }
|