Refactor plant selection options by authenticated user's plant ID.
This commit is contained in:
@@ -69,7 +69,11 @@ class LocatorValidation extends Page implements HasForms
|
||||
Select::make('plant_id')
|
||||
->label('Plant')
|
||||
->reactive()
|
||||
->options(Plant::pluck('name', 'id'))
|
||||
//->options(Plant::pluck('name', 'id'))
|
||||
->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();
|
||||
})
|
||||
->required(),
|
||||
TextInput::make('scan_pallet_no')
|
||||
->label('Scan Pallet No')
|
||||
|
||||
Reference in New Issue
Block a user