Add device groups syntax in Alerts-Templates

First of all, the new alerts template syntax is nice and simpler than the old one, good job and high five to the developer.

I would like to request to add syntax for device groups, something like

$alert->device_groups

to add info on which device group it belongs to

Thanks!

Anyone ending up here when searching for a way to add device group names in your alerts (template), here’s an example how to achieve this.
The extra ternary operator and if…then construction is needed for the template editor to accept the code.

@php
$d = \App\Models\Device::find($alert->device_id);
$groups = ($d) ? $d->groups():Array();
@endphp

@if ($groups)
@foreach ($groups->pluck('name')->toArray() as $group_name)
{{ $group_name }}
@endforeach
@endif

This is probably a solution for this closed post as well. If an admin can link these two posts, that might be useful for people researching the issue.
" Alert Template - Placeholder"