Open sidebar
Forms\Components\Select::make('country_id') ->relationship('country', 'name') ->searchable() ->preload() ->live() ->afterStateUpdated(function (Set $set) { $set('state_id', null); $set('city_id', null); }) ->label(__('filament.countrySelect')) ->required(), Forms\Components\Select::make('city_id') ->options(function (Get $get): Collection { $countryId = $get('country_id'); return State::query() ->where('country_id', $countryId) ->pluck('name', 'id'); }) ->searchable() ->live() ->preload() ->label(__('filament.citySelect')) ->required(), Forms\Components\Select::make('state_id') ->options(function (Get $get): Collection { $stateId = $get('state_id'); return City::query() ->where('state_id', $stateId) ->pluck('name', 'id'); }) ->searchable() ->live() ->preload() ->afterStateUpdated(fn(Set $set) => $set('city_id', null)) ->label(__('filament.stateSelect')),
Close sidebar
Back
Please note that all pasted data is publicly available.
X (fomerly Twitter)
GitHub
Use setting
Back
Please note that all pasted data is publicly available.
X (fomerly Twitter)
GitHub
Use setting