© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•12mo ago•
5 replies
jals65

Any way to get selected records on an bulkaction form?

Hi, I'm trying to get the selected records on a bulkaction to add the environments available on the multiselect options.

Any way to do that?

protected function setUp(): void
    {
        parent::setUp();
        $this->icon('heroicon-o-shield-check');
        $this->form(
            [
                Select::make('environments')
                    ->multiple()
                    ->options(function (Collection $records) {
                        $environments = [];
                        foreach ($records as $record) {
                            $projectEnvironments = Environment::where(EnvironmentInterface::PROJECT_ID, $record->name)->get();

                            foreach ($projectEnvironments as $projectEnvironment) {
                                $environments[$projectEnvironment] = "{$record->name} {$projectEnvironment->name}";
                            }
                        }

                        return $environments;
                    })
                    ->required()
            ]
        );
protected function setUp(): void
    {
        parent::setUp();
        $this->icon('heroicon-o-shield-check');
        $this->form(
            [
                Select::make('environments')
                    ->multiple()
                    ->options(function (Collection $records) {
                        $environments = [];
                        foreach ($records as $record) {
                            $projectEnvironments = Environment::where(EnvironmentInterface::PROJECT_ID, $record->name)->get();

                            foreach ($projectEnvironments as $projectEnvironment) {
                                $environments[$projectEnvironment] = "{$record->name} {$projectEnvironment->name}";
                            }
                        }

                        return $environments;
                    })
                    ->required()
            ]
        );
Solution
I can't get $livewire in the function parameter, but i can do
$this->getLivewire()->getSelectedTableRecords()
$this->getLivewire()->getSelectedTableRecords()
and it works
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

How to get selected records without any BulkAction or Action?
FilamentFFilament / ❓┊help
6mo ago
BulkAction options based on selected records.
FilamentFFilament / ❓┊help
2y ago
How to run a BulkAction on selected to table records
FilamentFFilament / ❓┊help
2y ago
How to Access Selected Records in a BulkAction::visible() in Filament?
FilamentFFilament / ❓┊help
4mo ago