Merge pull request 'Updated item code filter option against plant from stickerMaster' (#186) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 14s

Reviewed-on: #186
This commit was merged in pull request #186.
This commit is contained in:
2026-01-13 10:10:36 +00:00

View File

@@ -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(),