diff --git a/app/Filament/Resources/StickerMasterResource.php b/app/Filament/Resources/StickerMasterResource.php index 733723e..21b2c40 100644 --- a/app/Filament/Resources/StickerMasterResource.php +++ b/app/Filament/Resources/StickerMasterResource.php @@ -620,7 +620,17 @@ class StickerMasterResource extends Resource ->options(function (callable $get) { $plantId = $get('Plant'); - return $plantId ? Item::where('plant_id', $plantId)->pluck('code', 'id') : []; + if (! $plantId) { + return []; + } + + return Item::whereHas('stickerMasters', function ($query) use ($plantId) { + if ($plantId) { + $query->where('plant_id', $plantId); + } + })->pluck('code', 'id'); + + // return $plantId ? Item::where('plant_id', $plantId)->pluck('code', 'id') : []; }) ->searchable() ->reactive(),