belongsTo(Order::class, 'order_id', 'id'); } /** * @notes 获取器-关联类型描述 */ public function getRelatedTypeDescAttr($value, $data) { $typeMap = ['appointment' => '挂号', 'diagnosis' => '问诊', 'medicine' => '药品']; return $typeMap[$data['related_type']] ?? '未知'; } }