Open spitfire64 opened 9 months ago
Hi @spitfire64 , not sure if you already did but you can do
public Product $product;
public function deleteProduct(int $productId): void
{
$this->product = Product::find($productId);
if ($this->product) {
$this->confirm('Are you sure do want to leave?', [
'onConfirmed' => 'confirmed', // function to call when user click yes
]);
}
}
public function confirmed(): void
{
$this->product->delete();
}
public function confirmed(): void { $this->product->delete(); } this function will not work.
need to add listeners. =>
protected $listeners = [
'confirmed'
];
How can I accomplish this? Also It would be nice with a success alert after delete is complete At the moment I have this code that results in a standard, ugly alert when I want to delete a Product. app\Livewire\Products.php
resources\views\livewire\products.blade.php
I use Livewire 3 Laravel 10