'json']; protected $appends = ['files']; public function getFilesAttribute($value) { if (empty($this->file_ids)) return []; return Upload::whereIn('id', $this->file_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'); } }