unreadNotifications()->latest()->limit(20)->get(); } #[Computed] public function unreadCount(): int { return Auth::user()->unreadNotifications()->count(); } public function markAsRead(string $id): void { Auth::user()->notifications()->where('id', $id)->first()?->markAsRead(); unset($this->notifications, $this->unreadCount); } public function markAllAsRead(): void { Auth::user()->unreadNotifications->each->markAsRead(); unset($this->notifications, $this->unreadCount); } public function render() { return view('livewire.notification-bell'); } }