user()?->unreadNotifications()->count() ?? 0; } public function getNotificationsProperty() { return auth()->user()?->notifications()->latest()->take(10)->get() ?? collect(); } public function toggle(): void { $this->open = ! $this->open; } public function markRead(string $id): void { auth()->user()?->notifications()->where('id', $id)->first()?->markAsRead(); } public function markAllRead(): void { auth()->user()?->unreadNotifications->markAsRead(); $this->open = false; } public function render() { return view('livewire.components.notifications-bell'); } }