Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

PetroGromovo's avatar

Have widgets of filament option to add customer filters ?

Have widgets of filament 3 on laravel to add customer filters ? In filament 2 there was such an option with getTableFilters method of BaseWidget. But adding such method in widget :

<?php

namespace App\Filament\Widgets;

use App\Models\Item;
use Filament\Forms\Components\DatePicker;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Filters\Filter;
use Filament\Tables\Table;
use Filament\Widgets\TableWidget as BaseWidget;
use Illuminate\Database\Eloquent\Builder;

class ItemsForManagersReview extends BaseWidget
{

    public static function canView(): bool
    {
        return true;
    }

    public function table(Table $table): Table
    {
        $this->columnSpan = 'full';

        return $table
            ->query(Item::query()->getByStatus(true))
            ->striped()
            ->columns([
                TextColumn::make('id')->sortable(),
                ...
                TextColumn::make('name')->sortable()->searchable()->toggleable(),
                ...
            ]);
    }

    protected function isTablePaginationEnabled() : bool {
        return false;
    }


    protected function getTableFilters(): array
    {
        // This method is not called
        return [
            Filter::make('created_at')
                ->form([
                    DatePicker::make('created_from'),
                    DatePicker::make('created_until'),
                ])
            ...
            ;
        ];

    }

}
"laravel/framework": "^10.28.0",
"filament/filament": "^3.0-stable",

Thanks in advance! Also I did not find any filters mentioned at https://filamentphp.com/docs/3.x/widgets docs...

0 likes
0 replies

Please or to participate in this conversation.