fix: scope create form priorities to selected group; reset on group change

This commit is contained in:
Joel Wedemire
2026-04-08 19:06:38 -07:00
parent 652829ab90
commit f2b614abb7
2 changed files with 14 additions and 2 deletions

View File

@@ -245,7 +245,11 @@ class TicketController extends Controller
]);
}
$priorities = PriorityLevel::orderBy('sort_order')->get();
// Only pass global priorities + priorities scoped to accessible groups
$groupIds = $groups->pluck('id')->toArray();
$priorities = PriorityLevel::where(fn($q) => $q->whereNull('group_id')->orWhereIn('group_id', $groupIds))
->orderBy('sort_order')
->get();
return Inertia::render('Ticketing/Create', [
'groups' => $groups,