© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
5 replies
Diogo Pinto

SelectFilter relationship field

Hello all,

I have a users table, with a relation (HasOne) user_meta table. So the relationship is:

$user->meta->professional_category

That returns the professional category of the user.

So, why doesn't this filter work?

Tables\Filters\SelectFilter::make('professional_category')
    ->options(ProfessionalCategory::class) //Enum Class
    ->relationship('meta', 'professional_category')
    ->preload(),
Tables\Filters\SelectFilter::make('professional_category')
    ->options(ProfessionalCategory::class) //Enum Class
    ->relationship('meta', 'professional_category')
    ->preload(),


The output:

Filament\Forms\Components\Select::getRelationship(): Return value must be of type Illuminate\Database\Eloquent\Relations\BelongsTo|Illuminate\Database\Eloquent\Relations\BelongsToMany|Znck\Eloquent\Relations\BelongsToThrough|null, Illuminate\Database\Eloquent\Relations\HasOne returned
Filament\Forms\Components\Select::getRelationship(): Return value must be of type Illuminate\Database\Eloquent\Relations\BelongsTo|Illuminate\Database\Eloquent\Relations\BelongsToMany|Znck\Eloquent\Relations\BelongsToThrough|null, Illuminate\Database\Eloquent\Relations\HasOne returned


I don't know what I'm doing wrong. Must I run the query directly?
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

SelectFilter with relationship help...
FilamentFFilament / ❓┊help
2y ago
SelectFilter with relationship query
FilamentFFilament / ❓┊help
2y ago
SelectFilter unique/distinct relationship value
FilamentFFilament / ❓┊help
2y ago
SelectFilter by 2 level relationship
FilamentFFilament / ❓┊help
2y ago