Releases: jantinnerezo/livewire-alert
2.1 Release
What's new?
- Added PHP 8.0 support
- Removed
<x-livewire::confirm />
component - Added multiple confirmation alerts on a single livewire component
- Refactor confirmation alerts to use livewire event listeners to handle callbacks.
- Removed the need to use Alpine.js, it's no longer required.
- Refactor Alpine.js code to vanilla js for alert confirmation.
- Refactor alert javascript codes.
- Added config.php file with default SweetAlert2 config.
- Removed SweetAlert2 script tag, should no longer be included by default.
Breaking changes
Ditched the <x-livewire::confirm />
component.
In the previous version 2.0 you may add the <x-livewire::confirm />
and define the onConfirmed
and onCancelled
callback as props like the code below.
<x-livewire::confirm onConfirmed="confirmed" onCancelled="cancelled" />
However when you have multiple confirmation alerts in the same livewire component this is not be possible and can cause multiple calls of javascript code with Alpine.js which is required to make the confirmation works.
In the latest version which is 2.1 , the <x-livewire::confirm />
component is removed and you can directly add your callback methods to the confirm config in your livewire component class.
public function confirmed()
{
//
}
public function cancelled()
{
//
}
Register the callback methods as event listeners.
protected $listeners = [
'confirmed',
'cancelled'
];
Add the event listeners to the confirm config.
// Trigger action method
public function triggerConfirm()
{
$this->confirm('Do you love Livewire Alert?', [
'toast' => false,
'position' => 'center',
'showConfirmButton' => true,
'cancelButtonText' => Nope,
'onConfirmed' => 'confirmed', // Add the confirmed callback method here
'onCancelled' => 'cancelled' // Add the cancelled callback method here
];
}
For more information please visit the documentation page: https://livewire-alert.jantinnerezo.com/
Alert Confirmation
Added support for alert confirmation.
Flash Messages
Added support for session flash messages out-of-the-box.
Livewire Alert 2.0
Livewire Alert 2.0 Release
- Removed LivewireAlert trait
- Added livewire component macro for calling alert directly instead of using trait on each livewire components.
- Fixed Laravel 8.0 and livewire 2.0 conflict because of blade directive for scripts.
- Added script component to embed sweetalert2
That's it folks!