How to get $data in Tables\Actions\CreateAction::make()?

I used to get the $data in the form using ->before(function (RelationManager $livewire, array $data, Tables\Actions\CreateAction $action) { if ($data['total'] > 0) { But it doesn't work now, probably since some upgrade. This is a Table inside a RelationManager. Any help?
3 Replies
Tally
Tally2mo ago
we need more context to help you
fede8100
fede81002mo ago
In a RelationManager, in the Table, I have this code "return $table ->headerActions([ Tables\Actions\CreateAction::make() ->createAnother(false) ->before(function (RelationManager $livewire, array $data, Tables\Actions\CreateAction $action) { if ($data['total'] > 0) {

} else { Notification::make() ->title('It was canceled, the value can't be zero') ->warning() ->send(); $action->cancel(); } }) ->after(function (RelationManager $livewire, CreditNote $record, array $data) {
}), ])" This code was working since months ago, I used to access the $data array with the data in the form. But since a few updates ago, first $data didn't include the disabled() components, but now it seems that I can't access the $data anymore in the before() method, so I can't control that everything is fine or do an action based on the form data.
Dan Harrin
Dan Harrin2mo ago
we released a fix for the bug
Want results from more Discord servers?
Add your server
More Posts