F
Filament8mo ago
lxbln

filter table by default (without the option to remove the filter)

The question is actually pretty simple. In my users table I have a column 'type'. Some users are of type 'admin'. In filament I want to manage only those users. Can I define a filter, that sets type='admin', which can also not be removed. Ideally the filter would not even be visible. Thanks.
Solution:
Hi. You don't need a filter...just modify your table query: $table->modifyQueryUsing(fn (Builder $query) => $query->where('type', 'admin')
Jump to solution
2 Replies
Solution
Kenneth Sese
Kenneth Sese8mo ago
Hi. You don't need a filter...just modify your table query: $table->modifyQueryUsing(fn (Builder $query) => $query->where('type', 'admin')
lxbln
lxbln8mo ago
thanks! This is exactly what I needed.