How add a query to the table
In this table, I need to display only the users where is_super in the database is set to false.
I just started using Filament today. Can someone help me?
19 Replies
you would have to rewrite the "query" function on the same file you are on
it didnt worked
how is your model setup?
you didin't show the table headers to me
only values
how's the model setup for users?
como tá a model de usuários?
Br?
protected $fillable = [
'name',
'email',
'password',
'active',
'is_admin',
'is_super'
];
it just the fillable
yes, i'm also from brazil
Ah beleza
O model tá assim
given that the group chat is international, we should stick to english so other people could join and help
Ok
we might also add translation below for better expression of ideas
is it really a boolean there?
Yes
the migration
I see, if that did not do it, you might be able to add a custom filter
in your $table variable on table function
it would look like this for your code
its a hidden toggle, i bet its not the best option for it, but it might solve your problem
the presented solutions were of your approval?
Apply this query in your resource
public static function getEloquentQuery(): Builder
{
return static::getModel()::query()->where(‘is_super’, 0);
}
modifyQueryUsing is the proper place to do this. https://filamentphp.com/docs/3.x/panels/resources/listing-records#customizing-the-table-eloquent-query