uvatechs/livewire-sweetalert

There is no license information available for the latest version (v1.0.0) of this package.

Reusable SweetAlert integration for Laravel Livewire

v1.0.0 2025-05-15 11:46 UTC

This package is not auto-updated.

Last update: 2025-06-13 11:24:05 UTC


README

A simple reusable package to integrate SweetAlert2 with Laravel Livewire.

Installation

  1. Add the package to your Laravel app (if locally linked):
composer require uvatechs/livewire-sweetalert
  1. Add component to your layout:
<livewire:sweet-alert />
  1. Use the trait in your Livewire components:
use Uvatechs\\LivewireSweetAlert\\Traits\\WithSweetAlert;

class SomeComponent extends Component
{
    use WithSweetAlert;

    public function save()
    {
        $this->alert('Saved!', 'Item saved successfully.', 'success');
    }
}
  1. Trigger confirmation dialogs:
$this->confirm('deleteConfirmed', ['id' => $id], [
            'title' => 'Are you sure?',
            'text' => 'This action cannot be undone.',
        ]);
public function deleteConfirmed($id)
    {
        // Handle confirmed deletion...
    }

Publishing Views

php artisan vendor:publish --tag=views

Contributing

Contributions are welcome! Feel free to open issues or submit pull requests.

License

This package is open-sourced software licensed under the MIT license.