From 255353763f669f303e1aaaf73ac01541c5866008 Mon Sep 17 00:00:00 2001 From: "Ralph J. Smit" <59207045+ralphjsmit@users.noreply.github.com> Date: Thu, 28 Sep 2023 20:57:58 +0200 Subject: [PATCH] Add clarifying comment --- app/Filament/Resources/PackageResource.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/Filament/Resources/PackageResource.php b/app/Filament/Resources/PackageResource.php index b1d2056..8165aa9 100644 --- a/app/Filament/Resources/PackageResource.php +++ b/app/Filament/Resources/PackageResource.php @@ -155,10 +155,14 @@ class PackageResource extends Resource }) ->action(function (Package $record, array $data) { $providerPlanIds = collect($data) + // If `select_specific_provider_plans`, all provider plans are available. It could be that this + // option was deselected, and that we have some left over provider plans in the field that + // is now hidden. We will not include theSE IDs so that they ARE detached automatically. ->where('select_specific_provider_plans', true) ->pluck('provider_plans') ->flatten(); + // Detaches provider plans not specifically selected. $record->providerPlans()->sync($providerPlanIds); Notification::make()