loadNotifications(); } public function loadNotifications() { $user = Auth::user(); $this->notifications = $user->notifications()->latest()->take(10)->get()->toArray(); $this->unreadCount = $user->unreadNotifications()->count(); } public function markAsRead($id) { Auth::user()->notifications()->where('id', $id)->update(['read_at' => now()]); $this->loadNotifications(); } public function markAllAsRead() { Auth::user()->unreadNotifications->markAsRead(); $this->loadNotifications(); } public function render() { return view('livewire.notification-bell'); } }