© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
2 replies
Ric Le Poidevin

How to get current record on Table action using a custom form field

Hi,

I have a Resource with a Table action using a custom field. I need pass data to the view for this action - all works well for user details but how do I pass the current record’s ID? I’ve tried lots of approaches but it never passes the data

// Resource class action $table actions
Tables\Actions\Action::make('Publish')
    ->form([
        BraintreePayment::make('Billing details')
            ->viewData([
                'first_name' => auth()->user()->first_name,
                ...
                'payment' => [
                    'type' => 'publish',
                    // 'record_id' => fn (Model $record) => $record,
                    'record_id' => fn ($form) => $form->getRecord(),  // $record->id,
                ]
            ])
    ])
// Resource class action $table actions
Tables\Actions\Action::make('Publish')
    ->form([
        BraintreePayment::make('Billing details')
            ->viewData([
                'first_name' => auth()->user()->first_name,
                ...
                'payment' => [
                    'type' => 'publish',
                    // 'record_id' => fn (Model $record) => $record,
                    'record_id' => fn ($form) => $form->getRecord(),  // $record->id,
                ]
            ])
    ])


I know I can get the record in my BraintreePayment Blade using
recordId: '{{ $getRecord()->id }}'
recordId: '{{ $getRecord()->id }}'
but this doesn’t work for me as I want to pass in an object of data to make the component describing the type of payment being made more reusable for different situations.
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

Get current row record in custom action
FilamentFFilament / ❓┊help
2y ago
Custom Page Table Method Edit Action passing Current Record
FilamentFFilament / ❓┊help
13mo ago
I need to access $record on Table Action form
FilamentFFilament / ❓┊help
3y ago
Re-using a custom action on both a form and a table
FilamentFFilament / ❓┊help
2y ago