Fix duplicate maps in relationship (#16081)

When a device is added to a map multiple times, it caused the map to show multiple times in the device overview.
This commit is contained in:
Tony Murray
2024-05-30 23:32:22 -05:00
committed by GitHub
parent c777d5429e
commit cf422b834c

View File

@@ -802,7 +802,8 @@ class Device extends BaseModel
public function maps(): HasManyThrough
{
return $this->hasManyThrough(CustomMap::class, CustomMapNode::class, 'device_id', 'custom_map_id', 'device_id', 'custom_map_id');
return $this->hasManyThrough(CustomMap::class, CustomMapNode::class, 'device_id', 'custom_map_id', 'device_id', 'custom_map_id')
->distinct();
}
public function mefInfo(): HasMany