@foreach($version->assignments as $assignment)
@php
$target = $assignment['target'] ?? [];
$type = $target['@odata.type'] ?? 'unknown';
$intent = $assignment['intent'] ?? 'apply';
$typeName = match($type) {
'#microsoft.graph.groupAssignmentTarget' => 'Include group',
'#microsoft.graph.exclusionGroupAssignmentTarget' => 'Exclude group',
'#microsoft.graph.allLicensedUsersAssignmentTarget' => 'All Users',
'#microsoft.graph.allDevicesAssignmentTarget' => 'All Devices',
default => 'Unknown'
};
$groupId = $target['groupId'] ?? null;
$groupName = $target['group_display_name'] ?? null;
$groupOrphaned = $target['group_orphaned'] ?? ($version->metadata['has_orphaned_assignments'] ?? false);
$filterId = $target['deviceAndAppManagementAssignmentFilterId'] ?? null;
$filterType = $target['deviceAndAppManagementAssignmentFilterType'] ?? 'none';
$filterName = $target['assignment_filter_name'] ?? null;
@endphp
•
{{ $typeName }}
@if($groupId)
:
@if($groupOrphaned)
⚠️ Unknown group (ID: {{ $groupId }})
@elseif($groupName)
{{ $groupName }}
({{ $groupId }})
@else
Group ID: {{ $groupId }}
@endif
@endif
@if($filterId && $filterType !== 'none')
Filter ({{ $filterType }}): {{ $filterName ?? $filterId }}
@endif
({{ $intent }})
@endforeach