Here is a sample. I think this is what you're looking for...
in the main layout at the bottom...
<x-app-toaster-notification />
inside the component...
<div
x-cloak
x-data="{
isOpen : false,
type : 'success',
messageText: '',
showNotification(message, type){
this.type = type
this.isOpen = true
this.messageText = message
setTimeout(() => {
this.isOpen = false
}, 5000)
}
}"
// can show a notification via javascript...
@notify.window="showNotification($event.detail.message, $event.detail.type)"
// can show a notification via session variable being present...
@if( session('app_toaster') )
x-init="$nextTick(() => showNotification('{{ session('app_toaster')['message'] }}', '{{ session('app_toaster')['type'] }}'))"
@endif
x-show="isOpen"
...