F
Filament3mo ago
gg

Auto Select Issue in Select Option

when I try to auto select of cityids and it working well but it can also select value after auto selected.so that can cause duplicate Select::make('country_id') ->label('Country') ->reactive() ->required() ->placeholder('Please select a country') ->preload() ->searchable() ->options(Country::pluck('name', 'id')) ->afterStateUpdated(function ($state, Set $set) { if ($state) { $cities = City::where('country_id', $state)->pluck('id')->toArray(); $set('city_ids', $cities); } ), Select::make('city_ids') ->label('City') ->placeholder('Please select your cities) ->multiple() ->preload() ->searchable() ->reactive() ->options(function (Get $get) { $country_id = $get('country_id'); if ($country_id) { return City::where('country_id', $countryId)->pluck('name', 'id'); } return []; }),
1 Reply
Moshiur
Moshiur3w ago
Bro, have you solve this issue? If yes, then share the solution, I am also facing the same issue

Did you find this page helpful?