© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•17mo ago•
5 replies
yagrasdemonde

Group Options in record Select in Relation Manager

Hello,

I'm trying to achieve to group options in Select record input in AttachAction in Relation Manager, but I have an error :
Method Illuminate\Support\Collection::getQuery does not exist.
Method Illuminate\Support\Collection::getQuery does not exist.
`

Tables\Actions\AttachAction::make()
->recordSelectOptionsQuery(function (Builder $query) {
                
    return $query->get()->groupBy('season')->map(function ($item) {
        return $item->keyBy('id')->map(fn ($item) => $item->title);
    });
    
})
Tables\Actions\AttachAction::make()
->recordSelectOptionsQuery(function (Builder $query) {
                
    return $query->get()->groupBy('season')->map(function ($item) {
        return $item->keyBy('id')->map(fn ($item) => $item->title);
    });
    
})


In Database I have a column
season
season
and so I would like to group options by season when I choose a record to attach.
In doc, (https://filamentphp.com/docs/3.x/forms/fields/select#grouping-options) to group options; values must be formatted like in example.

Doing
dd($query->get()->groupBy('season')->map(function ($item) {
        return $item->keyBy('id')->map(fn ($item) => $item->title);
    }));
dd($query->get()->groupBy('season')->map(function ($item) {
        return $item->keyBy('id')->map(fn ($item) => $item->title);
    }));

I have the good format.

Any help will be welcome.

Thanks
Select - Form Builder - Filament
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

Current record in relation manager
FilamentFFilament / ❓┊help
3y ago
Customize Select in Relation Manager
FilamentFFilament / ❓┊help
12mo ago
relation manager record information
FilamentFFilament / ❓┊help
2y ago
get select record on relation manager attach form
FilamentFFilament / ❓┊help
3y ago