Lionking-Dev
Pass arguments to `DeleteAction` in Livewire component
and
public function deleteMessage($messageId): Action
{
$this->selectedMessageId = $messageId;
return DeleteAction::make('deleteMessage')
->confirm('Are you sure you want to delete this message?')
->onSuccess(function () {
// Perform deletion logic here
$message = Message::find($this->selectedMessageId);
$message->delete();
// Show success notification or perform any other actions
$this->alert('success', 'Message deleted successfully!');
});
}
29 replies