Refactor plant selection logic in ItemResource and StickerMasterResource to order by code
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 12s
Gemini PR Review / review (pull_request) Failing after 22s
Laravel Larastan / larastan (pull_request) Failing after 2m19s
Laravel Pint / pint (pull_request) Failing after 2m50s

This commit is contained in:
dhanabalan
2025-12-01 10:09:22 +05:30
parent c8c38a05f4
commit 173638cd19
2 changed files with 10 additions and 14 deletions

View File

@@ -601,7 +601,7 @@ class StickerMasterResource extends Resource
->options(function (callable $get) {
$userHas = Filament::auth()->user()->plant_id;
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray();
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->orderBy('code')->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
})
->reactive()
->afterStateUpdated(function ($state, callable $set, callable $get): void {