forget(['selected_plant', 'selected_line']); $this->filtersForm->fill([ //'plant' => Plant::first()?->id // Default to first plant 'plant' => null, 'line' => null, ]); } public function filtersForm(Form $form): Form { return $form ->statePath('filters') ->schema([ Select::make('plant') ->options(Plant::pluck('name', 'id')) ->label('Select Plant') ->reactive() ->afterStateUpdated(function ($state) { session(['selected_plant' => $state]); }), // 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]); }), ]) ->columns(2); } public static function canAccess(): bool { return Auth::check() && Auth::user()->can('view production line stop count dashboard'); } }