22 lines
831 B
PHP
22 lines
831 B
PHP
<div>
|
|
<script>
|
|
document.addEventListener('alpine:initialized', () => {
|
|
const toast = @js(session()->get('toast', null));
|
|
|
|
if (!toast) {
|
|
return;
|
|
}
|
|
|
|
if (toast.type === 'success') {
|
|
$interaction('toast').success(toast.title ?? 'Éxito', toast.message).send();
|
|
} else if (toast.type === 'error') {
|
|
$interaction('toast').error(toast.title ?? 'Error', toast.message).send();
|
|
} else if (toast.type === 'warning') {
|
|
$interaction('toast').warning(toast.title ?? 'Advertencia', toast.message).send();
|
|
} else if (toast.type === 'info') {
|
|
$interaction('toast').info(toast.title ?? 'Información', toast.message).send();
|
|
}
|
|
});
|
|
</script>
|
|
</div>
|