guiiz
guiiz
FFilament
Created by guiiz on 1/14/2025 in #❓┊help
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?
public static function table(Table $table): Table
{
return $table

->columns([
Tables\Columns\TextColumn::make('name')
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('email')
->searchable()
->sortable(),
Tables\Columns\ToggleColumn::make('active')
->label('Ativo')
->sortable(),
Tables\Columns\ToggleColumn::make('is_admin')
->label('Admin')
->sortable()
->disabled(fn (?Model $record) => $record?->id === Auth::id()),
Tables\Columns\TextColumn::make('created_at')
->searchable()
->sortable()
->dateTime()
->formatStateUsing(fn ($state) => \Carbon\Carbon::parse($state)->format('d/m/y H:i')),
])
->filters([
//
])
->actions([
Tables\Actions\EditAction::make(),
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make(),
])

,
]);

}
public static function table(Table $table): Table
{
return $table

->columns([
Tables\Columns\TextColumn::make('name')
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('email')
->searchable()
->sortable(),
Tables\Columns\ToggleColumn::make('active')
->label('Ativo')
->sortable(),
Tables\Columns\ToggleColumn::make('is_admin')
->label('Admin')
->sortable()
->disabled(fn (?Model $record) => $record?->id === Auth::id()),
Tables\Columns\TextColumn::make('created_at')
->searchable()
->sortable()
->dateTime()
->formatStateUsing(fn ($state) => \Carbon\Carbon::parse($state)->format('d/m/y H:i')),
])
->filters([
//
])
->actions([
Tables\Actions\EditAction::make(),
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make(),
])

,
]);

}
33 replies