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(),


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


I don't know what I'm doing wrong. Must I run the query directly?
Was this page helpful?