Код: Выделить всё
@if (Auth::check())
var post_userId = {{ Auth::user()->id }};
Echo.private(`real-notification.${post_userId}`)
.listen('CommentNotification', (data) => {
var notificationsWrapper = $('.alert-dropdown');
var notificationsToggle = notificationsWrapper.find('a[data-bs-toggle]');
var notificationsCountElem = notificationsToggle.find('span[data-count]');
var notificationsCount = parseInt(notificationsCountElem.text());
var notifications = notificationsWrapper.find('div.alert-body');
var existingNotifications = notifications.html();
var newNotificationHtml = '[url=#]\
\
Подробнее здесь: [url]https://stackoverflow.com/questions/78563872/uncaught-referenceerror-echo-is-not-defined-laravel-9-how-can-i-solve-this-iss[/url]