Skip to content

Deleting rows with action button #1032

Closed Answered by alukardua1
blackquail asked this question in Q&A
Discussion options

You must be logged in to vote

I just added to the data table Class

public function destroy(int $id): RedirectResponse|bool
	{
		$delete = $this->model::find($id);
		if($delete) {
			return $delete->flushQueryCache(['nord_'])->delete();
		}
		
		return $this->isError($delete, 'global.err_del');
	}

and called through

<button wire:click="destroy(' . $row->id . ')" class="btn btn-sm btn-danger shadow" onclick="return confirm(\'' . __('global.confirm_delete'
				) . '\')"><i class="fa-solid fa-trash-can"></i></button>

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by blackquail
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@santizix
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants