@php /** * Notification bell — shared by the storefront header and the dashboard topbar. * Each signed-in user sees only their own notifications. The list is rendered from the * database on load and kept current by notifications.js (same-origin polling, no external * calls); a short local chime plays for a new notification when sound is enabled. Sound and * live updates require BOTH the platform master switch and the user's own preference. */ use App\Support\Auth; $nUser = Auth::user(); $nUid = (int) ($nUser['id'] ?? 0); $nItems = $nUid > 0 ? notifications_recent($nUid, 8) : []; $nUnread = $nUid > 0 ? notifications_unread($nUid) : 0; $nPrefs = $nUid > 0 ? notification_prefs($nUid) : notification_prefs_defaults(); $nRealtime = setting('notify_realtime_enabled', '1') === '1' && !empty($nPrefs['realtime']); $nSound = setting('notify_sound_enabled', '1') === '1' && !empty($nPrefs['sound']); @endphp