lcly-data-admin/app/Enums/DeviceType.php

33 lines
724 B
PHP

<?php
namespace App\Enums;
enum DeviceType: int
{
case Monitor = 1; // 监控设备
case Soil = 2; // 土壤设备
case WaterQuality = 3; // 水质设备
case Meteorological = 4; // 气象设备
/**
* @return string
*/
public function typeName(): string
{
return static::types()[$this->value];
}
/**
* @return array
*/
public static function types(): array
{
return [
static::Monitor->value => '监控设备',
static::Soil->value => '土壤设备',
static::WaterQuality->value => '水质设备',
static::Meteorological->value => '气象设备',
];
}
}