© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
13 replies
dusan8061

Pre-select filters in table

Hey guys,

I have widget Staff Widget. Depending on the role which user is logged in, I have to create pre-select filter in the table.

So this is StaffWidget.php in widgets folder :

    protected function getTableColumns(): array
    {
        return [
            Tables\Columns\TextColumn::make('name'),
            Tables\Columns\TextColumn::make('roles.name')
        ];
    }
    protected function getTableColumns(): array
    {
        return [
            Tables\Columns\TextColumn::make('name'),
            Tables\Columns\TextColumn::make('roles.name')
        ];
    }


and this is the code from UserResource.php :

                Forms\Components\TextInput::make('name')->required(),
                Forms\Components\TextInput::make('email')->required(),
                Forms\Components\Select::make('organisation')->relationship('organisation', 'name'),
                Forms\Components\TextInput::make('name')->required(),
                Forms\Components\TextInput::make('email')->required(),
                Forms\Components\Select::make('organisation')->relationship('organisation', 'name'),


Bottom line, If I am logged in as a customer, role "customers" should be pre-selected on the Users overview page.
Thanks in advance!
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Table Select Filters
FilamentFFilament / ❓┊help
13mo ago
Pre-select records on the table
FilamentFFilament / ❓┊help
3mo ago
Having in Table Filters
FilamentFFilament / ❓┊help
3y ago
related select filters
FilamentFFilament / ❓┊help
17mo ago