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

wordxpression's avatar

Filament seems to be missing some classes...

I'm new to Filament, working with Filament 3.

When I try to create a custom dashboard with a filter form, according to the documentation first create a Dashboard page https://filamentphp.com/docs/3.x/panels/dashboard#customizing-the-dashboard-page and then add a filter form to it. https://filamentphp.com/docs/3.x/panels/dashboard#filtering-widget-data

With my installation there is one issue however. Looking at the example code to use

use Filament\Forms\Components\DatePicker;
use Filament\Forms\Components\Section;
use Filament\Forms\Form;
use Filament\Pages\Dashboard as BaseDashboard;
use Filament\Pages\Dashboard\Concerns\HasFiltersForm;

there should have been a 'Dashboard\Concerns\ folder somewhere. Can't find it however.

I'm clueless how to solve this.

0 likes
5 replies
LaryAI's avatar
Level 58

It seems like you might be facing an issue with the Filament version or the documentation might be outdated or incorrect. The HasFiltersForm trait should be part of the Filament package, and if it's not present in your installation, there might be a few things you can check:

  1. Ensure that you have the correct version of Filament installed that includes the HasFiltersForm trait. You mentioned you are working with Filament 3, so double-check your composer.json file to make sure you have the correct version specified.

  2. Run composer update to make sure all your dependencies are up to date. Sometimes the code might not be up to date with the documentation if you have an older version of the package installed.

  3. If the trait is indeed missing from the package, it could be an issue with the package itself. In this case, you might want to check the Filament GitHub repository or reach out to the maintainers for support.

  4. As a last resort, you can manually create the trait by following the documentation and the expected behavior of the HasFiltersForm trait. However, this should be unnecessary if the package is correctly installed and up to date.

If you've checked all the above and still can't find the HasFiltersForm trait, here's a basic example of how you might define a custom dashboard with a filter form without the trait, using the available Filament forms components:

use Filament\Forms\Components\DatePicker;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Pages\Page;

class CustomDashboard extends Page
{
    protected static string $view = 'filament.pages.custom-dashboard';

    protected function getFormSchema(): array
    {
        return [
            DatePicker::make('start_date')
                ->label('Start Date'),
            DatePicker::make('end_date')
                ->label('End Date'),
            // Add other filters as needed
        ];
    }

    public function mount(): void
    {
        // You can initialize your form data here if needed
    }

    // Add methods to handle form submissions and filter your widgets accordingly
}

In your resources/views/filament/pages/custom-dashboard.blade.php, you would then render the form and handle the data to filter your dashboard widgets.

Remember to check the official Filament documentation or their support channels for the most accurate and up-to-date information.

eEduard's avatar

composer update did the trick for me. It really seamed an error as grep -r 'HasFilterForm' gave no result but my own references.

wordxpression's avatar

Btw, after a later update with a newer version the problem seems to be solved. Still a mystery what the actual reason was.

Please or to participate in this conversation.