© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
14 replies
H.Bilbao

Delete values from dependant select

I have the following code:

Select::make('nations')
    ->relationship(name: 'nations', titleAttribute: 'name')
    ->searchable()
    ->multiple()
    ->required()
    ->preload()
    ->live(),

Select::make('championships')
    ->relationship(
        name: 'championships',
        titleAttribute: 'name',
        modifyQueryUsing: fn (Builder $query, Get $get) => $query->whereHas('nations', function ($subquery) use ($get) {
            $subquery->whereIn('nation_id', $get('nations'));
        }),
    )
    ->searchable()
    ->multiple()
    ->required()
    ->preload(),
Select::make('nations')
    ->relationship(name: 'nations', titleAttribute: 'name')
    ->searchable()
    ->multiple()
    ->required()
    ->preload()
    ->live(),

Select::make('championships')
    ->relationship(
        name: 'championships',
        titleAttribute: 'name',
        modifyQueryUsing: fn (Builder $query, Get $get) => $query->whereHas('nations', function ($subquery) use ($get) {
            $subquery->whereIn('nation_id', $get('nations'));
        }),
    )
    ->searchable()
    ->multiple()
    ->required()
    ->preload(),


It works correctly but if for example I delete a record from the first select, the related records from the second select are not deleted. How could I do it?

Thank you
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Select dependant from TextInput
FilamentFFilament / ❓┊help
3y ago
Dependant Select
FilamentFFilament / ❓┊help
3y ago
Dependant select options using QueryBuilder
FilamentFFilament / ❓┊help
2y ago
Dependant select in modal form
FilamentFFilament / ❓┊help
2y ago