© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
4 replies
Pasteko

->modifyQueryUsing with relations

Hello, I need to use a 'details' relation to query the state, how can I do this?

Tried to add ->with('details') or -details(), please help.

$query->with('details')->where('state', 1))

$query->details()->where('state', 1))

Thanks

public function getTabs(): array
    {
        return [
            'enabled' => Tab::make()
            ->modifyQueryUsing(fn (Builder $query) => $query->where('state', 1)),
            'all' => Tab::make(),                
            'disabled' => Tab::make()
                ->modifyQueryUsing(fn (Builder $query) => $query->where('state', 0)),
        ];
    }
public function getTabs(): array
    {
        return [
            'enabled' => Tab::make()
            ->modifyQueryUsing(fn (Builder $query) => $query->where('state', 1)),
            'all' => Tab::make(),                
            'disabled' => Tab::make()
                ->modifyQueryUsing(fn (Builder $query) => $query->where('state', 0)),
        ];
    }
Solution
You are probably looking for
->whereHas('details', fn ($query) => ...)
->whereHas('details', fn ($query) => ...)
or a simple join
Jump to solution
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

modifyQueryUsing with a role
FilamentFFilament / ❓┊help
3y ago
List Resources - GetTabs: modifyQueryUsing not working with relationships or scopes
FilamentFFilament / ❓┊help
3y ago
modifyQueryUsing breaks ToggleColumn
FilamentFFilament / ❓┊help
2y ago
FileUpload with relations
FilamentFFilament / ❓┊help
2y ago