input('filters.Plant')); return $form->schema([ // Plant Filter Select::make('Plant') ->options(Plant::pluck('name', 'id')) // Fetch plant names with their IDs ->label('Select Plant') ->reactive() ->afterStateUpdated(function ($state, callable $set) use ($selectedPlant) { // Update only in memory and not in the URL session(['selected_plant' => $state]); // Store in session session()->forget('selected_line'); // Reset line filter $set('Plant', $state); $set('Line', null); $this->dispatch('filtersUpdated'); // Notify chart to refresh }), // Line Filter Select::make('Line') ->options(function ($get) { $plantId = $get('Plant'); return $plantId ? Plant::find($plantId)->getLineNames()->pluck('name', 'id') : []; }) ->label('Select Line') ->reactive() ->afterStateUpdated(function ($state) { session(['selected_line' => $state]); // Store in session $this->dispatch('filtersUpdated'); // Notify chart to refresh }), ]); } }