FilamentF
Filament2y ago
AxlF

Select first item

Hey,

I would like to select the first option item, but somehow it isn't working as expected. UI wise, I get the result when I use ->selectablePlaceholder(false). But the form throws a validation required error on that field.

                Forms\Components\Select::make('project_id')
                    ->relationship(
                        name: 'project',
                        titleAttribute: 'title',
                        modifyQueryUsing: fn (Builder $query) => $query->whereHas('users', fn ($q) => $q->where('user_id', auth()->id()))->orderBy('title')
                    )
                    ->label('Projekt')
                    ->columnSpanFull()
                    ->selectablePlaceholder(false)
                    ->required(),


What am I doing wrong?

Bye
Was this page helpful?