in resources/js/app.js
add global toast
window.toast = function(message, options = {}) {
window.dispatchEvent(new CustomEvent('toast-show', {
detail: {
message,
type: options.type || 'default',
description: options.description || '',
position: options.position || 'top-right',
html: options.html || ''
}
}));
}
For usage in other view, just call toast('message')
another example
toast('Success!', {
type: 'success',
description: 'Operation completed successfully',
position: 'top-right'
});