diff --git a/app/Models/ParkingSpaceType.php b/app/Models/ParkingSpaceType.php index b6e470f..30b7c15 100644 --- a/app/Models/ParkingSpaceType.php +++ b/app/Models/ParkingSpaceType.php @@ -25,6 +25,7 @@ class ParkingSpaceType extends Model 'attr_color_occupy', 'attr_color_vacant', 'attr_color_warning', + 'attr_is_warning', 'attr_is_flicker' ]; protected $hidden @@ -43,4 +44,19 @@ class ParkingSpaceType extends Model { return self::query()->select(['id', 'name'])->get()->toArray(); } + + // 获取默认车位类型 + public static function getDefaultData() + { + $res = self::query()->where('is_default', 1)->first(['id', 'name']); + if ($res) { + return $res; + } else { + $res = self::query()->first(['id', 'name']); + if ($res) { + return $res; + } + } + return []; + } }