From f484285488ac69387a4c360831bad93dfe72cd9d Mon Sep 17 00:00:00 2001 From: wanghongjun <1445693971@qq.com> Date: Mon, 27 Apr 2026 16:04:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=BD=A6=E4=BD=8D=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E6=9B=B4=E6=96=B02?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Models/ParkingSpaceType.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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 []; + } }