How to trigger table action outside table with AlpineJS?
I have following table action. How to trigger it (and pass record id) from menu.blade(not filament admin) with alpinejs?
protected function getTableActions(): array
{
return [
Action::make('balance')
->label('Change balance')
->form([
TextInput::make('new_balance')
->default(fn (Sim $record) => $record->balance)
->label('New balance')
->numeric()
->step(0.01)
->minValue(0)
->required()
])
->action(function (Sim $record, array $data){
$record->update(['balance' => $data['new_balance']]);
Notification::make()->success()->title('Balance updated!')->send();
})
->modalButton('Update balance'),
];
}
1 Reply
something like $wire.mountTableAction('balance', {{RECORD_ID_HERE}})