© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•15mo ago•
1 reply
JonatasBraz

Change Bulk Action Visibility Based on Selected Row's field value

Is it possible to change Bulk Action Visiblity based on selected row's attributes? For example, i want to show "Desfazer" Bulk Action only if selected row's Fl_finalizado = true. i tried the following code, but it keeps me showing the error App\Filament\Resources\SorteioResource::App\Filament\Resources{closure}(): Argument #1 ($records) must be of type Illuminate\Support\Collection, null given.

                    ->visible(function (Collection $records) {
                        // Verificando se todas as linhas selecionadas têm fl_finalizado = true
                        return $records->every(fn($record) => $record->fl_finalizado);
                    })
                    ->visible(function (Collection $records) {
                        // Verificando se todas as linhas selecionadas têm fl_finalizado = true
                        return $records->every(fn($record) => $record->fl_finalizado);
                    })


also tried this to avoid the error, but the action never shows:

                   ->visible(function (Collection $records = null) {
                        // Verifica se as linhas selecionadas são válidas
                        if ($records === null) {
                            return false; // Se não houver registros selecionados, retorna false
                        }

                        // Verificando se todas as linhas selecionadas têm fl_finalizado = true
                        return $records->every(fn($record) => $record->fl_finalizado);
                    })
                   ->visible(function (Collection $records = null) {
                        // Verifica se as linhas selecionadas são válidas
                        if ($records === null) {
                            return false; // Se não houver registros selecionados, retorna false
                        }

                        // Verificando se todas as linhas selecionadas têm fl_finalizado = true
                        return $records->every(fn($record) => $record->fl_finalizado);
                    })
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

Bulk Action: change "x records selected"
FilamentFFilament / ❓┊help
12mo ago
Disable Bulk action if some row is selected.
FilamentFFilament / ❓┊help
17mo ago
Change column value from row action
FilamentFFilament / ❓┊help
2y ago
Change repeater field label based on other field value
FilamentFFilament / ❓┊help
16mo ago