Courses

Practical Livewire 3: Order Management System Step-by-Step

Products Delete and Multi-Delete

You're reading a FREE PREVIEW of a PREMIUM course.

In this lesson, we will delete products one by one, or by selecting and deleting in bulk. In this, we will use the same sweetalert2 package to show confirmation, as we used in categories.

First, let's make deletion work by deleting a single product, which will be identical to what we did with categories. We will start by adding action to the Delete button.

resources/views/livewire/products-list.blade.php:

<button wire:click="deleteConfirm('delete', {{ $product->id }})" class="px-4 py-2 text-xs text-red-500 uppercase bg-red-200 rounded-md border border-transparent hover:text-red-700 hover:bg-red-300">
Delete
</button>

Now, we need to add a listener and deleteConfirm() with delete() methods to the Livewire component...

The full lesson is only for Premium Members.
Want to access all 17 text lessons of this course? (93 min read)

You also get:

  • 76 courses
  • Premium tutorials
  • Access to repositories
  • Private Discord