Fix AlertRule relationships (#14500)

This commit is contained in:
Tony Murray
2022-10-24 09:54:59 -05:00
committed by GitHub
parent 707f2cd29f
commit 62aa77c0a0

View File

@@ -88,6 +88,16 @@ class AlertRule extends BaseModel
public function devices(): BelongsToMany
{
return $this->belongsToMany(\App\Models\Device::class, 'alert_device_map', 'device_id', 'device_id');
return $this->belongsToMany(\App\Models\Device::class, 'alert_device_map', 'rule_id', 'device_id');
}
public function groups(): BelongsToMany
{
return $this->belongsToMany(\App\Models\DeviceGroup::class, 'alert_group_map', 'rule_id', 'group_id');
}
public function locations(): BelongsToMany
{
return $this->belongsToMany(\App\Models\Location::class, 'alert_location_map', 'rule_id');
}
}