GL
How to completely override the search query for Select while also using relationship?
Seems i found the solution by looking at the source code of Select.
When you provide an empty array to searchable it won't apply the automatic LIKE due to no columns defined.
This Select won't apply the LIKE in final db query
Select::make('authors')
->native(false)
->searchable([])
->multiple()
->relationship(
name: 'authors',
titleAttribute: 'name',
modifyQueryUsing: fn (Builder $query, ?string $search) => $query
->when($search, fn ($q) => $q->whereFullText(['name'], $search, ['mode' => 'boolean']))
->orderByDesc('views')
)
->searchDebounce(300)
8 replies