'json']; protected $appends = ['files']; public function getFilesAttribute($value) { $ids = AppointmentType::normalizeJsonIdList($this->file_ids); if (empty($ids)) { return []; } return Upload::whereIn('id', $ids)->get(); } /** * 通过键名获取值 */ public static function getValueByKey($key) { $config = Cache::remember('appointment_config_array', 300, function () { return self::pluck('value', 'key')->toArray(); }); if (isset($config[$key])) { return $config[$key]; } return null; } public function appointmentType() { return $this->hasOne(AppointmentType::class, 'id', 'appointment_type_id'); } }