Is there a way to group options on a select when using a relationship?

It appears that using both ->options() and ->relationship doesn't really play well together.

I'm trying to create group options like seen here: https://filamentphp.com/docs/3.x/forms/fields/select#grouping-options

When I do this and try to select an option, I get the following error:
SQLSTATE[42S22]: [Microsoft][ODBC Driver 18 for SQL Server][SQL Server]Invalid column name 'collections'.

When I instead use the relationship method, then the options method doesn't seem to work.

My code:

Tables\Filters\SelectFilter::make('collections')
    ->label('Collections')
    ->multiple()
    ->options([
        'Private collections' => AccountCollection::ownedByCurrentUser()->private()->orderBy('name')->pluck('name', 'id')->all(),
        'Public collections' => AccountCollection::public()->orderBy('name')->pluck('name', 'id')->all(),
    ]),
Was this page helpful?