Refactor plant selection logic to filter by user-specific plant ID in various resources
This commit is contained in:
@@ -514,7 +514,11 @@ class PalletValidationResource extends Resource
|
||||
->schema([
|
||||
Forms\Components\Select::make('plant')
|
||||
->label('Select Plant')
|
||||
->options(Plant::pluck('name', 'id')->toArray())
|
||||
// ->options(Plant::pluck('name', 'id')->toArray())
|
||||
->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()
|
||||
->reactive()
|
||||
->columnSpan(2),
|
||||
|
||||
Reference in New Issue
Block a user