Table Header Actions: How to access data?

I have a RelationManager table, and I am trying to add a quick payment action on it which would create a new PaymentRecord

->headerActions([
    Tables\Actions\Action::make('quick-payment')->label('Quick Payment')
        ->action(function (PhoneMembership $record, array $data) {
            dd($data);
        })
        ->color('success'),
    Tables\Actions\CreateAction::make()->label('Add Manual Transaction')->slideOver()->modalWidth('lg'),
])


Trying to figure out how to access PhoneMembership info

$record->phoneMembershipRecords()->create([
    'date' => now(),
    'type' => EType::CREDIT,
    'value' => $data['value'],
    'memo' => 'Quick payment',
]);
e3628eee856949b5f37a525c135441f4.png
Solution
                Tables\Actions\Action::make('quick-payment')->label('Quick Payment')
                    ->action(function () {
                        $this->ownerRecord->phoneMembershipRecords()->create([
                            'date' => now(),
                            'type' => EType::CREDIT,
                            'value' => $this->ownerRecord->billing_cycle * $this->ownerRecord->monthly_rate,
                            'memo' => 'Quick Payment',
                        ]);
                    })
Was this page helpful?